class OmniAuth::Strategies::YahooOauth2
Constants
- ALLOWED_ISSUERS
- OPEN_ID_CONNECT_SCOPES
Public Instance Methods
raw_info()
click to toggle source
# File lib/omniauth/strategies/yahoo_oauth2.rb, line 77 def raw_info @raw_info ||= access_token.get(userinfo_url).parsed end
Private Instance Methods
callback_url()
click to toggle source
This follows the example in omniauth-google-oauth2.
Probably better to set the redirect_uri as a client option when creating the client, because OAuth2::Client knows how to handle it, but that requires updating OmniAuth::Strategies::OAuth2.
# File lib/omniauth/strategies/yahoo_oauth2.rb, line 88 def callback_url options[:redirect_uri] || (full_host + script_name + callback_path) end
decode_info_token()
click to toggle source
This is copied from the omniauth-google-oauth2 gem
# File lib/omniauth/strategies/yahoo_oauth2.rb, line 129 def decode_info_token unless options[:skip_jwt] || access_token['id_token'].nil? decoded = ::JWT.decode(access_token['id_token'], nil, false).first # We have to manually verify the claims because the third parameter to # JWT.decode is false since no verification key is provided. ::JWT::Verify.verify_claims(decoded, verify_iss: true, iss: ALLOWED_ISSUERS, verify_aud: true, aud: options.client_id, verify_sub: false, verify_expiration: true, verify_not_before: true, verify_iat: true, verify_jti: false, leeway: options[:jwt_leeway]) decoded end end
prune!(hash)
click to toggle source
This is copied from the omniauth-google-oauth2 gem
# File lib/omniauth/strategies/yahoo_oauth2.rb, line 102 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
userinfo_url()
click to toggle source
# File lib/omniauth/strategies/yahoo_oauth2.rb, line 92 def userinfo_url options.client_options.site + options.userinfo_url end
verified_email()
click to toggle source
This is copied from the omniauth-google-oauth2 gem
# File lib/omniauth/strategies/yahoo_oauth2.rb, line 97 def verified_email raw_info['email_verified'] ? raw_info['email'] : nil end