Class: OmniAuth::Swagger::OAuth2Definition
- Inherits:
-
Object
- Object
- OmniAuth::Swagger::OAuth2Definition
- Defined in:
- lib/omniauth/swagger/oauth2_definition.rb
Constant Summary collapse
- OPTION_CLIENT_ID =
'client_id'.freeze
- OPTION_CLIENT_SECRET =
'client_secret'.freeze
- OPTION_AUTHORIZE_URL =
'authorize_url'.freeze
- OPTION_TOKEN_URL =
'token_url'.freeze
- OPTION_SCOPE =
'scope'.freeze
- OPTION_SUBDOMAIN =
'subdomain'.freeze
Instance Attribute Summary collapse
-
#client_id ⇒ Object
readonly
Returns the value of attribute client_id.
-
#client_options ⇒ Object
readonly
Returns the value of attribute client_options.
-
#client_secret ⇒ Object
readonly
Returns the value of attribute client_secret.
Instance Method Summary collapse
- #authorize_params ⇒ Object
-
#initialize(security_def, spec, options) ⇒ OAuth2Definition
constructor
A new instance of OAuth2Definition.
- #load_options(options) ⇒ Object
- #oauth2_key ⇒ Object
- #scopes ⇒ Object
Constructor Details
#initialize(security_def, spec, options) ⇒ OAuth2Definition
Returns a new instance of OAuth2Definition.
15 16 17 |
# File 'lib/omniauth/swagger/oauth2_definition.rb', line 15 def initialize(security_def, spec, ) @security_def, @spec, @options = security_def, spec, end |
Instance Attribute Details
#client_id ⇒ Object (readonly)
Returns the value of attribute client_id.
13 14 15 |
# File 'lib/omniauth/swagger/oauth2_definition.rb', line 13 def client_id @client_id end |
#client_options ⇒ Object (readonly)
Returns the value of attribute client_options.
13 14 15 |
# File 'lib/omniauth/swagger/oauth2_definition.rb', line 13 def @client_options end |
#client_secret ⇒ Object (readonly)
Returns the value of attribute client_secret.
13 14 15 |
# File 'lib/omniauth/swagger/oauth2_definition.rb', line 13 def client_secret @client_secret end |
Instance Method Details
#authorize_params ⇒ Object
35 36 37 |
# File 'lib/omniauth/swagger/oauth2_definition.rb', line 35 def @security_def.extensions[:authorize_parameters] end |
#load_options(options) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/omniauth/swagger/oauth2_definition.rb', line 19 def () [:client_id] = @options[OPTION_CLIENT_ID] [:client_secret] = @options[OPTION_CLIENT_SECRET] [:client_options][OPTION_AUTHORIZE_URL] = prepare_url(@security_def.) [:client_options][OPTION_TOKEN_URL] = prepare_url(@security_def.token_url) [:scope] = @options[OPTION_SCOPE] end |
#oauth2_key ⇒ Object
27 28 29 |
# File 'lib/omniauth/swagger/oauth2_definition.rb', line 27 def oauth2_key @security_def.id.to_sym end |
#scopes ⇒ Object
31 32 33 |
# File 'lib/omniauth/swagger/oauth2_definition.rb', line 31 def scopes @security_def.scopes ? @security_def.scopes.keys : [] end |