Class: OmniAuth::Swagger::OAuth2Definition

Inherits:
Object
  • Object
show all
Defined in:
lib/omniauth/swagger/oauth2_definition.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(security_def, options) ⇒ OAuth2Definition

Returns a new instance of OAuth2Definition.



8
9
10
# File 'lib/omniauth/swagger/oauth2_definition.rb', line 8

def initialize(security_def, options)
  @security_def, @options = security_def, options
end

Instance Attribute Details

#client_idObject (readonly)

Returns the value of attribute client_id.



6
7
8
# File 'lib/omniauth/swagger/oauth2_definition.rb', line 6

def client_id
  @client_id
end

#client_optionsObject (readonly)

Returns the value of attribute client_options.



6
7
8
# File 'lib/omniauth/swagger/oauth2_definition.rb', line 6

def client_options
  @client_options
end

#client_secretObject (readonly)

Returns the value of attribute client_secret.



6
7
8
# File 'lib/omniauth/swagger/oauth2_definition.rb', line 6

def client_secret
  @client_secret
end

Instance Method Details

#authorize_paramsObject



28
29
30
# File 'lib/omniauth/swagger/oauth2_definition.rb', line 28

def authorize_params
  @security_def.extensions[:authorize_parameters]
end

#load_options(options) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/omniauth/swagger/oauth2_definition.rb', line 12

def load_options(options)
  options[:client_id] = @options[:client_id]
  options[:client_secret] = @options[:client_secret]
  options[:client_options][:authorize_url] = @security_def.authorization_url
  options[:client_options][:token_url] = @security_def.token_url
  options[:scope] = @options[:scope]
end

#oauth2_keyObject



20
21
22
# File 'lib/omniauth/swagger/oauth2_definition.rb', line 20

def oauth2_key
  @security_def.id.to_sym
end

#scopesObject



24
25
26
# File 'lib/omniauth/swagger/oauth2_definition.rb', line 24

def scopes
  @security_def.scopes ? @security_def.scopes.keys : []
end