class OmniAuth::Strategies::Idq

Public Instance Methods

authorize_params() click to toggle source

Allow push_token param through

Calls superclass method
# File lib/omniauth/strategies/idq.rb, line 89
def authorize_params
  super.merge(push_token: request.params['push_token'], response_to: 'delegated_authorization')
end
callback_url() click to toggle source

Need to patch the original callback_url method the original puts all params from query_string onto the callback url idQ does not support this behaviour. However, we need the Omniauth feature to store k-v pairs from query string in the request.env for handling delegated authorization requests in a stateless fashion.

# File lib/omniauth/strategies/idq.rb, line 98
def callback_url
  full_host + script_name + callback_path
end
request_phase() click to toggle source

Patched request_phase

# File lib/omniauth/strategies/idq.rb, line 78
def request_phase
  # If a push_token was passed in, we want to carry out a delegated authorization
  if request.params['push_token']
    redirect client.delegated_authorization.authorize_url({:redirect_uri => callback_url}.merge(authorize_params))
  else
    # Otherwise proceed with the original omniauth-oauth2 request_phase
    request_phase_original
  end
end
Also aliased as: request_phase_original
request_phase_original()
Alias for: request_phase

Private Instance Methods

raw_info() click to toggle source

Our custom raw_info method which will make idQ user attributes accessible to Omniauth

# File lib/omniauth/strategies/idq.rb, line 105
def raw_info
  @raw_info ||= MultiJson.decode(access_token.get('/idqoauth/api/v1/user').body)
rescue ::Errno::ETIMEDOUT
  raise ::Timeout::Error
end