Class: OmniAuth::Strategies::Honin

Inherits:
OAuth2
  • Object
show all
Defined in:
lib/omniauth/strategies/honin.rb

Constant Summary collapse

PKCE_VERIFIER_LENGTH =
64

Instance Method Summary collapse

Instance Method Details

#authorize_paramsObject



48
49
50
51
52
53
# File 'lib/omniauth/strategies/honin.rb', line 48

def authorize_params
  super.tap do |params|
    params[:code_challenge] = session[:honin_pkce_challenge]
    params[:code_challenge_method] = "S256"
  end
end

#callback_phaseObject



61
62
63
64
65
# File 'lib/omniauth/strategies/honin.rb', line 61

def callback_phase
  super
ensure
  clear_pkce_session!
end

#clientObject



90
91
92
93
94
95
# File 'lib/omniauth/strategies/honin.rb', line 90

def client
  @client ||= ::OAuth2::Client.new(options.client_id, options.client_secret,
    site: options.client_options.site,
    authorize_url: "#{options.base_path}/oauth/authorize",
    token_url: "#{options.base_path}/oauth/token")
end

#decoded_jwtObject



101
102
103
104
105
106
107
108
109
110
111
# File 'lib/omniauth/strategies/honin.rb', line 101

def decoded_jwt
  @decoded_jwt ||= begin
    token = access_token.token

    if jwks_verification_available?
      decode_verified_jwt(token)
    else
      decode_unverified_jwt(token)
    end
  end
end

#raw_infoObject



97
98
99
# File 'lib/omniauth/strategies/honin.rb', line 97

def raw_info
  @raw_info ||= decoded_jwt
end

#request_phaseObject



43
44
45
46
# File 'lib/omniauth/strategies/honin.rb', line 43

def request_phase
  generate_pkce!
  super
end

#token_paramsObject



55
56
57
58
59
# File 'lib/omniauth/strategies/honin.rb', line 55

def token_params
  super.tap do |params|
    params[:code_verifier] = session[:honin_pkce_verifier]
  end
end