Class: OmniAuth::Strategies::Samaritan
- Inherits:
-
OAuth2
- Object
- OAuth2
- OmniAuth::Strategies::Samaritan
- Defined in:
- lib/omniauth/strategies/samaritan.rb
Instance Method Summary collapse
- #authorization(client_id, client_secret) ⇒ Object
- #client ⇒ Object
- #client_options ⇒ Object
- #raw_info ⇒ Object
- #request_phase ⇒ Object
- #token_params ⇒ Object
Instance Method Details
#authorization(client_id, client_secret) ⇒ Object
49 50 51 |
# File 'lib/omniauth/strategies/samaritan.rb', line 49 def (client_id, client_secret) 'Basic ' + Base64.encode64(client_id + ':' + client_secret).gsub("\n", '') end |
#client ⇒ Object
41 42 43 |
# File 'lib/omniauth/strategies/samaritan.rb', line 41 def client ::OAuth2::Client.new(.client_id, .client_secret, deep_symbolize()) end |
#client_options ⇒ Object
24 25 26 27 28 29 |
# File 'lib/omniauth/strategies/samaritan.rb', line 24 def = . = . if .environment == :sandbox = . if .environment == :production end |
#raw_info ⇒ Object
73 74 75 76 |
# File 'lib/omniauth/strategies/samaritan.rb', line 73 def raw_info identity_endpoint = [:site].to_s.gsub(/\/\z/, '') + [:identity_url].to_s @raw_info ||= access_token.get(identity_endpoint).parsed end |
#request_phase ⇒ Object
31 32 33 34 35 36 37 38 39 |
# File 'lib/omniauth/strategies/samaritan.rb', line 31 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 ⇒ Object
45 46 47 |
# File 'lib/omniauth/strategies/samaritan.rb', line 45 def token_params super.merge({:headers => {'Authorization' => (.client_id, .client_secret)}}) end |