class OmniAuth::Strategies::Samaritan
Public Instance Methods
client()
click to toggle source
# File lib/omniauth/strategies/samaritan.rb, line 39 def client ::OAuth2::Client.new(options.client_id, options.client_secret, deep_symbolize(client_options)) end
client_options()
click to toggle source
# File lib/omniauth/strategies/samaritan.rb, line 22 def client_options client_options = options.client_options client_options = options.sandbox_client_options if options.environment == :sandbox client_options = options.production_client_options if options.environment == :production client_options end
raw_info()
click to toggle source
# File lib/omniauth/strategies/samaritan.rb, line 71 def raw_info identity_endpoint = client_options[:site].to_s.gsub(/\/\z/, '') + client_options[:identity_url].to_s @raw_info ||= access_token.get(identity_endpoint).parsed end
request_phase()
click to toggle source
Calls superclass method
# File lib/omniauth/strategies/samaritan.rb, line 29 def request_phase if request.params['access_token'] self.access_token = build_access_token_from_params(request.params) env['omniauth.auth'] = auth_hash call_app! else super end end
token_params()
click to toggle source
Calls superclass method
# File lib/omniauth/strategies/samaritan.rb, line 43 def token_params super.merge({:headers => {'Authorization' => authorization(options.client_id, options.client_secret)}}) end
Private Instance Methods
build_access_token_from_params(params)
click to toggle source
# File lib/omniauth/strategies/samaritan.rb, line 78 def build_access_token_from_params(params) ::OAuth2::AccessToken.new(client, params['access_token']) end
prune!(hash)
click to toggle source
# File lib/omniauth/strategies/samaritan.rb, line 82 def prune!(hash) hash.delete_if do |_, v| prune!(v) if v.is_a?(Hash) v.nil? || (v.respond_to?(:empty?) && v.empty?) end end