Class: OmniAuth::Strategies::ICOS
- Inherits:
-
OAuth2
- Object
- OAuth2
- OmniAuth::Strategies::ICOS
- Defined in:
- lib/omniauth/strategies/icos.rb
Constant Summary collapse
- DEFAULT_SCOPES =
'hydra.consent offline'
Instance Method Summary collapse
- #basic_auth_header ⇒ Object
- #build_access_token ⇒ Object
- #callback_url ⇒ Object
- #compact_full_name ⇒ Object
- #raw_info ⇒ Object
- #user_info ⇒ Object
Instance Method Details
#basic_auth_header ⇒ Object
81 82 83 |
# File 'lib/omniauth/strategies/icos.rb', line 81 def basic_auth_header 'Basic ' + Base64.strict_encode64("#{[:client_id]}:#{[:client_secret]}") end |
#build_access_token ⇒ Object
76 77 78 79 |
# File 'lib/omniauth/strategies/icos.rb', line 76 def build_access_token .token_params.merge!(:headers => {'Authorization' => basic_auth_header }) super end |
#callback_url ⇒ Object
62 63 64 |
# File 'lib/omniauth/strategies/icos.rb', line 62 def callback_url full_host + script_name + callback_path end |
#compact_full_name ⇒ Object
66 67 68 |
# File 'lib/omniauth/strategies/icos.rb', line 66 def compact_full_name [user_info['FirstName'], user_info['MiddleName'], user_info['LastName']].reject { |name| name.empty? }.join(' ') end |
#raw_info ⇒ Object
70 71 72 73 74 |
# File 'lib/omniauth/strategies/icos.rb', line 70 def raw_info @raw_info ||= MultiJson.decode(access_token.get('/v1/services/client/').body) rescue ::Errno::ETIMEDOUT raise ::Timeout::Error end |
#user_info ⇒ Object
85 86 87 |
# File 'lib/omniauth/strategies/icos.rb', line 85 def user_info @user_info ||= raw_info.nil? ? {} : raw_info['Result'] end |