Class: OmniAuth::Strategies::YahooJp
- Inherits:
-
OAuth2
- Object
- OAuth2
- OmniAuth::Strategies::YahooJp
show all
- Defined in:
- lib/omniauth/strategies/yahoojp.rb
Defined Under Namespace
Classes: IdTokenValidationError
Constant Summary
collapse
- JWKS_URI =
'https://auth.login.yahoo.co.jp/yconnect/v2/jwks'.freeze
- ISSUER =
'https://auth.login.yahoo.co.jp/yconnect/v2'.freeze
Instance Method Summary
collapse
Instance Method Details
#build_access_token ⇒ Object
94
95
96
97
98
99
100
101
102
103
|
# File 'lib/omniauth/strategies/yahoojp.rb', line 94
def build_access_token
token_params = {
:code => request.params['code'],
:redirect_uri => callback_url,
:grant_type => 'authorization_code',
:headers => {'Authorization' => HTTPAuth::Basic.pack_authorization(client.id, client.secret)}
}
client.get_token(token_params)
end
|
#callback_url ⇒ Object
105
106
107
|
# File 'lib/omniauth/strategies/yahoojp.rb', line 105
def callback_url
full_host + script_name + callback_path
end
|
#id_token ⇒ Object
76
77
78
|
# File 'lib/omniauth/strategies/yahoojp.rb', line 76
def id_token
@id_token ||= access_token&.params&.dig('id_token').presence
end
|
#id_token_claims ⇒ Object
80
81
82
83
84
85
|
# File 'lib/omniauth/strategies/yahoojp.rb', line 80
def id_token_claims
return nil unless id_token
@id_token_claims ||= verify_id_token!
rescue JSON::JWT::InvalidFormat
nil
end
|
#prune!(hash) ⇒ Object
87
88
89
90
91
92
|
# File 'lib/omniauth/strategies/yahoojp.rb', line 87
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
65
66
67
68
69
70
71
72
73
74
|
# File 'lib/omniauth/strategies/yahoojp.rb', line 65
def raw_info
@raw_info ||= if options.userinfo_access
access_token.options[:mode] = :header
access_token.get('https://userinfo.yahooapis.jp/yconnect/v2/attribute').parsed
elsif id_token
id_token_claims || {}
else
{}
end
end
|