Class: OmniAuth::Strategies::YahooJp
- Inherits:
-
OAuth2
- Object
- OAuth2
- OmniAuth::Strategies::YahooJp
- Defined in:
- lib/omniauth/strategies/yahoojp.rb
Instance Method Summary collapse
- #build_access_token ⇒ Object
- #callback_url ⇒ Object
- #id_token ⇒ Object
- #id_token_claims ⇒ Object
- #prune!(hash) ⇒ Object
- #raw_info ⇒ Object
- #request_phase ⇒ Object
Instance Method Details
#build_access_token ⇒ Object
75 76 77 78 79 80 81 82 83 84 |
# File 'lib/omniauth/strategies/yahoojp.rb', line 75 def build_access_token token_params = { :code => request.params['code'], :redirect_uri => callback_url, :grant_type => 'authorization_code', :headers => {'Authorization' => HTTPAuth::Basic.(client.id, client.secret)} } client.get_token(token_params); end |
#callback_url ⇒ Object
86 87 88 |
# File 'lib/omniauth/strategies/yahoojp.rb', line 86 def callback_url full_host + script_name + callback_path end |
#id_token ⇒ Object
90 91 92 |
# File 'lib/omniauth/strategies/yahoojp.rb', line 90 def id_token access_token&.params&.dig('id_token') end |
#id_token_claims ⇒ Object
94 95 96 |
# File 'lib/omniauth/strategies/yahoojp.rb', line 94 def id_token_claims JSON::JWT.decode(id_token, :skip_verification) end |
#prune!(hash) ⇒ Object
68 69 70 71 72 73 |
# File 'lib/omniauth/strategies/yahoojp.rb', line 68 def prune!(hash) hash.delete_if do |_, value| prune!(value) if value.is_a?(Hash) value.nil? || (value.respond_to?(:empty?) && value.empty?) end end |
#raw_info ⇒ Object
54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/omniauth/strategies/yahoojp.rb', line 54 def raw_info @raw_info ||= if .userinfo_access access_token.[:mode] = :header access_token.get(..userinfo_url).parsed elsif id_token id_token_claims.slice(:sub).merge( id_token: id_token, id_token_claims: id_token_claims, ) else {} end end |
#request_phase ⇒ Object
20 21 22 |
# File 'lib/omniauth/strategies/yahoojp.rb', line 20 def request_phase super end |