Class: OpenIDTokenProxy::Config

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize {|_self| ... } ⇒ Config

Returns a new instance of Config.

Yields:

  • (_self)

Yield Parameters:



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/openid_token_proxy/config.rb', line 17

def initialize
  @client_id = ENV['OPENID_CLIENT_ID']
  @client_secret = ENV['OPENID_CLIENT_SECRET']
  @issuer = ENV['OPENID_ISSUER']

  @domain_hint = ENV['OPENID_DOMAIN_HINT']
  @prompt = ENV['OPENID_PROMPT']
  @redirect_uri = ENV['OPENID_REDIRECT_URI']
  @resource = ENV['OPENID_RESOURCE']

  @authorization_uri = ENV['OPENID_AUTHORIZATION_URI']

  @authorization_endpoint = ENV['OPENID_AUTHORIZATION_ENDPOINT']
  @token_endpoint = ENV['OPENID_TOKEN_ENDPOINT']
  @userinfo_endpoint = ENV['OPENID_USERINFO_ENDPOINT']
  @end_session_endpoint = ENV['OPENID_END_SESSION_ENDPOINT']

  @token_acquirement_hook = proc { }
  @token_refreshment_hook = proc { }

  yield self if block_given?
end

Instance Attribute Details

#authorization_endpointObject

Returns the value of attribute authorization_endpoint.



10
11
12
# File 'lib/openid_token_proxy/config.rb', line 10

def authorization_endpoint
  @authorization_endpoint
end

#authorization_uriObject

Returns the value of attribute authorization_uri.



8
9
10
# File 'lib/openid_token_proxy/config.rb', line 8

def authorization_uri
  @authorization_uri
end

#client_idObject

Returns the value of attribute client_id.



5
6
7
# File 'lib/openid_token_proxy/config.rb', line 5

def client_id
  @client_id
end

#client_secretObject

Returns the value of attribute client_secret.



5
6
7
# File 'lib/openid_token_proxy/config.rb', line 5

def client_secret
  @client_secret
end

#domain_hintObject

Returns the value of attribute domain_hint.



6
7
8
# File 'lib/openid_token_proxy/config.rb', line 6

def domain_hint
  @domain_hint
end

#end_session_endpointObject

Returns the value of attribute end_session_endpoint.



10
11
12
# File 'lib/openid_token_proxy/config.rb', line 10

def end_session_endpoint
  @end_session_endpoint
end

#issuerObject

Returns the value of attribute issuer.



5
6
7
# File 'lib/openid_token_proxy/config.rb', line 5

def issuer
  @issuer
end

#promptObject

Returns the value of attribute prompt.



6
7
8
# File 'lib/openid_token_proxy/config.rb', line 6

def prompt
  @prompt
end

#public_keysObject

Returns the value of attribute public_keys.



15
16
17
# File 'lib/openid_token_proxy/config.rb', line 15

def public_keys
  @public_keys
end

#redirect_uriObject

Returns the value of attribute redirect_uri.



6
7
8
# File 'lib/openid_token_proxy/config.rb', line 6

def redirect_uri
  @redirect_uri
end

#resourceObject

Returns the value of attribute resource.



6
7
8
# File 'lib/openid_token_proxy/config.rb', line 6

def resource
  @resource
end

#token_acquirement_hookObject

Returns the value of attribute token_acquirement_hook.



13
14
15
# File 'lib/openid_token_proxy/config.rb', line 13

def token_acquirement_hook
  @token_acquirement_hook
end

#token_endpointObject

Returns the value of attribute token_endpoint.



10
11
12
# File 'lib/openid_token_proxy/config.rb', line 10

def token_endpoint
  @token_endpoint
end

#token_refreshment_hookObject

Returns the value of attribute token_refreshment_hook.



14
15
16
# File 'lib/openid_token_proxy/config.rb', line 14

def token_refreshment_hook
  @token_refreshment_hook
end

#userinfo_endpointObject

Returns the value of attribute userinfo_endpoint.



10
11
12
# File 'lib/openid_token_proxy/config.rb', line 10

def userinfo_endpoint
  @userinfo_endpoint
end

Instance Method Details

#provider_configObject



40
41
42
43
44
45
# File 'lib/openid_token_proxy/config.rb', line 40

def provider_config
  # TODO: Add support for refreshing provider configuration
  @provider_config ||= begin
    OpenIDConnect::Discovery::Provider::Config.discover! issuer
  end
end