Skip to content

Commit

Permalink
Updates from review
Browse files Browse the repository at this point in the history
  • Loading branch information
dazuma committed Oct 4, 2024
1 parent 31df18d commit 4f70cdc
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/googleauth/signet.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,12 @@ def retry_with_error max_retry_count = 5
def expires_at_from_id_token id_token
match = /^[\w=-]+\.([\w=-]+)\.[\w=-]+$/.match id_token.to_s
return unless match
base64 = Base64.urlsafe_decode64 match[1]
json = JSON.parse base64 rescue nil
return unless json.respond_to?(:key?) && json.key?("exp")
json = JSON.parse Base64.urlsafe_decode64 match[1]
return unless json.key? "exp"
Time.at json["exp"].to_i
rescue StandardError
# Shouldn't happen unless we get a garbled ID token
nil
end
end
end
Expand Down

0 comments on commit 4f70cdc

Please sign in to comment.