Class: OmniAuth::Strategies::DelegatedAuthentication
- Inherits:
-
Object
- Object
- OmniAuth::Strategies::DelegatedAuthentication
- Includes:
- OmniAuth::Strategy
- Defined in:
- lib/omniauth/strategies/omniauth-delegated-authentication.rb
Defined Under Namespace
Classes: CallbackError
Instance Attribute Summary collapse
-
#consent_token ⇒ Object
Returns the value of attribute consent_token.
Instance Method Summary collapse
- #callback_phase ⇒ Object
- #callback_url ⇒ Object
-
#client ⇒ Object
AFIK there is no DelegatedAuthentication gem currently available, so this developer strategy assumes that this class will be overwritten by the provider strategy.
-
#request_phase ⇒ Object
Assumes that the provider strategy client method includes ‘getConsentUrl`.
Instance Attribute Details
#consent_token ⇒ Object
Returns the value of attribute consent_token.
12 13 14 |
# File 'lib/omniauth/strategies/omniauth-delegated-authentication.rb', line 12 def @consent_token end |
Instance Method Details
#callback_phase ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/omniauth/strategies/omniauth-delegated-authentication.rb', line 29 def callback_phase if request.params['action'] == "cancel" raise CallbackError.new(request.params['action'], request.params['ResponseCode']) end self. = self. = client.refreshConsentToken(self.) unless .isValid? super rescue CallbackError => e fail!(:invalid_credentials, e) end |
#callback_url ⇒ Object
20 21 22 |
# File 'lib/omniauth/strategies/omniauth-delegated-authentication.rb', line 20 def callback_url full_host + script_name + callback_path end |
#client ⇒ Object
AFIK there is no DelegatedAuthentication gem currently available, so this developer strategy assumes that this class will be overwritten by the provider strategy
16 17 18 |
# File 'lib/omniauth/strategies/omniauth-delegated-authentication.rb', line 16 def client ::DelegatedAuthentication.new([:app_id], [:app_secret], nil, nil, [:privacy_url], callback_url) end |
#request_phase ⇒ Object
Assumes that the provider strategy client method includes ‘getConsentUrl`
25 26 27 |
# File 'lib/omniauth/strategies/omniauth-delegated-authentication.rb', line 25 def request_phase redirect client.getConsentUrl([:scope], nil, callback_url, nil) end |