Class: SparkApi::Authentication::OAuth2Impl::GrantTypeBase
- Inherits:
-
Object
- Object
- SparkApi::Authentication::OAuth2Impl::GrantTypeBase
- Defined in:
- lib/spark_api/authentication/oauth2_impl/grant_type_base.rb
Direct Known Subclasses
Constant Summary collapse
- GRANT_TYPES =
[:authorization_code, :password, :refresh_token]
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#provider ⇒ Object
readonly
Returns the value of attribute provider.
-
#session ⇒ Object
readonly
Returns the value of attribute session.
Class Method Summary collapse
Instance Method Summary collapse
- #authenticate ⇒ Object
-
#initialize(client, provider, session) ⇒ GrantTypeBase
constructor
A new instance of GrantTypeBase.
- #refresh ⇒ Object
Constructor Details
#initialize(client, provider, session) ⇒ GrantTypeBase
Returns a new instance of GrantTypeBase.
25 26 27 28 29 |
# File 'lib/spark_api/authentication/oauth2_impl/grant_type_base.rb', line 25 def initialize(client, provider, session) @client = client @provider = provider @session = session end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
24 25 26 |
# File 'lib/spark_api/authentication/oauth2_impl/grant_type_base.rb', line 24 def client @client end |
#provider ⇒ Object (readonly)
Returns the value of attribute provider.
24 25 26 |
# File 'lib/spark_api/authentication/oauth2_impl/grant_type_base.rb', line 24 def provider @provider end |
#session ⇒ Object (readonly)
Returns the value of attribute session.
24 25 26 |
# File 'lib/spark_api/authentication/oauth2_impl/grant_type_base.rb', line 24 def session @session end |
Class Method Details
.create(client, provider, session = nil) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/spark_api/authentication/oauth2_impl/grant_type_base.rb', line 7 def self.create(client, provider, session=nil) granter = nil case provider.grant_type when :authorization_code granter = GrantTypeCode.new(client, provider, session) when :password granter = GrantTypePassword.new(client, provider, session) # This method should only be used internally to the library when :refresh_token granter = GrantTypeRefresh.new(client, provider, session) else raise ClientError, "Unsupported grant type [#{provider.grant_type}]" end SparkApi.logger.debug { "[oauth2] setup #{granter.class.name}" } granter end |
Instance Method Details
#authenticate ⇒ Object
30 31 32 |
# File 'lib/spark_api/authentication/oauth2_impl/grant_type_base.rb', line 30 def authenticate end |
#refresh ⇒ Object
34 35 36 |
# File 'lib/spark_api/authentication/oauth2_impl/grant_type_base.rb', line 34 def refresh end |