Skip to content

Commit 5298eb1

Browse files
nevanszquestz
authored andcommitted
Use jwt v2.9.2's public claims verification API
This is a continuation of #464, which fixed backward compatibility with jwt v2.9.0 and v2.9.1. v2.9.2 brought back the removed APIs, for backward compatibility, but marked them as internal only and/or deprecated. For context, see the discussion here: * jwt/ruby-jwt#623 * jwt/ruby-jwt#626
1 parent 4dea8db commit 5298eb1

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

lib/omniauth/strategies/google_oauth2.rb

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -76,17 +76,11 @@ def authorize_params
7676

7777
# We have to manually verify the claims because the third parameter to
7878
# JWT.decode is false since no verification key is provided.
79-
::JWT::Claims.verify!(decoded,
80-
verify_iss: true,
81-
iss: ALLOWED_ISSUERS,
82-
verify_aud: true,
83-
aud: options.client_id,
84-
verify_sub: false,
85-
verify_expiration: true,
86-
verify_not_before: true,
87-
verify_iat: false,
88-
verify_jti: false,
89-
leeway: options[:jwt_leeway])
79+
::JWT::Claims.verify_payload!(decoded,
80+
iss: ALLOWED_ISSUERS,
81+
aud: options.client_id,
82+
exp: { leeway: options.jwt_leeway },
83+
nbf: { leeway: options.jwt_leeway })
9084

9185
hash[:id_info] = decoded
9286
end

omniauth-google-oauth2.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Gem::Specification.new do |gem|
2020

2121
gem.required_ruby_version = '>= 2.5'
2222

23-
gem.add_runtime_dependency 'jwt', '>= 2.9'
23+
gem.add_runtime_dependency 'jwt', '>= 2.9.2'
2424
gem.add_runtime_dependency 'oauth2', '~> 2.0'
2525
gem.add_runtime_dependency 'omniauth', '~> 2.0'
2626
gem.add_runtime_dependency 'omniauth-oauth2', '~> 1.8'

0 commit comments

Comments
 (0)