Class: SignIn::OpenidConnectCertificatesPresenter

Inherits:
Object
  • Object
show all
Defined in:
app/services/sign_in/openid_connect_certificates_presenter.rb

Instance Method Summary collapse

Instance Method Details

#performObject



5
6
7
8
9
# File 'app/services/sign_in/openid_connect_certificates_presenter.rb', line 5

def perform
  {
    keys: public_keys_jwk
  }
end

#private_key(file_path: Settings.sign_in.jwt_encode_key) ⇒ Object (private)



26
27
28
# File 'app/services/sign_in/openid_connect_certificates_presenter.rb', line 26

def private_key(file_path: Settings..jwt_encode_key)
  OpenSSL::PKey::RSA.new(File.read(file_path))
end

#public_keysObject (private)



19
20
21
22
23
24
# File 'app/services/sign_in/openid_connect_certificates_presenter.rb', line 19

def public_keys
  public_keys = [private_key.public_key]
  old_key_file_path = Settings..jwt_old_encode_key
  public_keys.push private_key(file_path: old_key_file_path).public_key if old_key_file_path
  public_keys
end

#public_keys_jwkObject (private)



13
14
15
16
17
# File 'app/services/sign_in/openid_connect_certificates_presenter.rb', line 13

def public_keys_jwk
  public_keys.map do |public_key|
    JWT::JWK.new(public_key, { alg: 'RS256', use: 'sig' }).export
  end
end