Class: Authinator::AuthCodeExchanger
- Inherits:
-
Object
- Object
- Authinator::AuthCodeExchanger
- Defined in:
- lib/authinator/auth_code_exchanger.rb
Constant Summary collapse
- STUB_SAMPLE_TOKEN =
{ token: 'ya29.token', refresh_token: '1/refresh', expires_in: 3600, }
Instance Attribute Summary collapse
-
#provider ⇒ Object
readonly
Returns the value of attribute provider.
Class Method Summary collapse
-
.valid_providers ⇒ Object
attr_reader :client.
Instance Method Summary collapse
- #exchange(auth_code) ⇒ Object
-
#initialize(provider, _client_options = {}) ⇒ AuthCodeExchanger
constructor
A new instance of AuthCodeExchanger.
- #site_token_url ⇒ Object
Constructor Details
#initialize(provider, _client_options = {}) ⇒ AuthCodeExchanger
18 19 20 |
# File 'lib/authinator/auth_code_exchanger.rb', line 18 def initialize(provider, = {}) @provider = provider end |
Instance Attribute Details
#provider ⇒ Object (readonly)
Returns the value of attribute provider.
11 12 13 |
# File 'lib/authinator/auth_code_exchanger.rb', line 11 def provider @provider end |
Class Method Details
.valid_providers ⇒ Object
attr_reader :client
14 15 16 |
# File 'lib/authinator/auth_code_exchanger.rb', line 14 def self.valid_providers Authinator.configuration.providers end |
Instance Method Details
#exchange(auth_code) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/authinator/auth_code_exchanger.rb', line 26 def exchange(auth_code) # auth_code = params[:code] return if auth_code.nil? || auth_code.empty? case @provider.name when :google exchange_with_google(auth_code) when :stub exchange_with_stub(auth_code) end end |
#site_token_url ⇒ Object
22 23 24 |
# File 'lib/authinator/auth_code_exchanger.rb', line 22 def site_token_url @provider.site + @provider.token_url end |