Class: InstAccess::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/inst_access/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(raw_signing_key, raw_encryption_key = nil, issuers: nil, service_jwks: []) ⇒ Config

Returns a new instance of Config.



27
28
29
30
31
32
33
34
35
36
37
# File 'lib/inst_access/config.rb', line 27

def initialize(raw_signing_key, raw_encryption_key = nil, issuers: nil, service_jwks: [])
  @signing_key = OpenSSL::PKey::RSA.new(raw_signing_key)
  if raw_encryption_key
    @encryption_key = OpenSSL::PKey::RSA.new(raw_encryption_key)
    raise ArgumentError, 'the encryption key should be a public RSA key' if @encryption_key.private?
  end
  @issuers = issuers
  @service_jwks = service_jwks
rescue OpenSSL::PKey::RSAError => e
  raise ArgumentError, e
end

Instance Attribute Details

#issuersObject (readonly)

Returns the value of attribute issuers.



25
26
27
# File 'lib/inst_access/config.rb', line 25

def issuers
  @issuers
end

#service_jwksObject (readonly)

Returns the value of attribute service_jwks.



25
26
27
# File 'lib/inst_access/config.rb', line 25

def service_jwks
  @service_jwks
end

#signing_keyObject (readonly)

Returns the value of attribute signing_key.



25
26
27
# File 'lib/inst_access/config.rb', line 25

def signing_key
  @signing_key
end

Instance Method Details

#encryption_keyObject



39
40
41
# File 'lib/inst_access/config.rb', line 39

def encryption_key
  @encryption_key || raise(ConfigError, 'Encryption key is not configured')
end