Class: Code0::Identities::IdentityProvider
- Inherits:
-
Object
- Object
- Code0::Identities::IdentityProvider
- Defined in:
- lib/code0/identities/identity_provider.rb,
sig/code0/identities/identity_provider.rbs
Instance Attribute Summary collapse
-
#providers ⇒ Hash[Symbol, Provider::BaseOauth]
readonly
Returns the value of attribute providers.
Class Method Summary collapse
Instance Method Summary collapse
- #add_named_provider(provider_id, provider_type, config) ⇒ void
- #add_provider(provider_type, config) ⇒ void
-
#initialize ⇒ IdentityProvider
constructor
A new instance of IdentityProvider.
- #load_identity(provider_id, params) ⇒ Identity
Constructor Details
#initialize ⇒ IdentityProvider
Returns a new instance of IdentityProvider.
8 9 10 |
# File 'lib/code0/identities/identity_provider.rb', line 8 def initialize @providers = {} end |
Instance Attribute Details
#providers ⇒ Hash[Symbol, Provider::BaseOauth] (readonly)
Returns the value of attribute providers.
6 7 8 |
# File 'lib/code0/identities/identity_provider.rb', line 6 def providers @providers end |
Class Method Details
.for_type(provider_type) ⇒ Class
30 31 32 |
# File 'lib/code0/identities/identity_provider.rb', line 30 def self.for_type(provider_type) Identities::Provider.const_get(provider_type.capitalize) end |
Instance Method Details
#add_named_provider(provider_id, provider_type, config) ⇒ void
This method returns an undefined value.
16 17 18 19 |
# File 'lib/code0/identities/identity_provider.rb', line 16 def add_named_provider(provider_id, provider_type, config) provider = Identities::Provider.const_get(provider_type.capitalize).new(config) providers[provider_id] = provider end |
#add_provider(provider_type, config) ⇒ void
This method returns an undefined value.
12 13 14 |
# File 'lib/code0/identities/identity_provider.rb', line 12 def add_provider(provider_type, config) add_named_provider provider_type, provider_type, config end |
#load_identity(provider_id, params) ⇒ Identity
21 22 23 24 25 26 27 28 |
# File 'lib/code0/identities/identity_provider.rb', line 21 def load_identity(provider_id, params) provider = providers[provider_id] if provider.nil? raise Error, "Provider with id '#{provider_id}' is not configured, did you forget to use add_provider" end provider.load_identity(**params) end |