google-id-token 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/README.rdoc +1 -1
  2. data/lib/google-id-token.rb +10 -1
  3. metadata +3 -3
@@ -9,7 +9,7 @@ GoogleIDToken currently provides a single useful class "Validator", which provid
9
9
  === Examples
10
10
 
11
11
  validator = GoogleIDToken::Validator.new
12
- jwt = validator.validate(token, required_audience, required_client_id)
12
+ jwt = validator.check(token, required_audience, required_client_id)
13
13
  if jwt
14
14
  email = jwt['email']
15
15
  else
@@ -52,7 +52,7 @@ module GoogleIDToken
52
52
  # @param [String] aud
53
53
  # The required audience value
54
54
  # @param [String] cid
55
- # The optional client-id value
55
+ # The optional client-id ("azp" field) value
56
56
  #
57
57
  # @return [Hash] The decoded ID token, or null
58
58
  def check(token, aud, cid = nil)
@@ -93,6 +93,15 @@ module GoogleIDToken
93
93
  begin
94
94
  public_key = cert.public_key
95
95
  @token = JWT.decode(token, public_key, !!public_key)
96
+
97
+ # in Feb 2013, the 'cid' claim became the 'azp' claim per changes
98
+ # in the OIDC draft. At some future point we can go all-azp, but
99
+ # this should keep everything running for a while
100
+ if @token['azp']
101
+ @token['cid'] = @token['azp']
102
+ elsif @token['cid']
103
+ @token['azp'] = @token['cid']
104
+ end
96
105
  rescue JWT::DecodeError
97
106
  nil # go on, try the next cert
98
107
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-id-token
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-12-06 00:00:00.000000000 Z
13
+ date: 2013-02-22 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: multi_json
@@ -120,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
120
120
  version: '0'
121
121
  requirements: []
122
122
  rubyforge_project:
123
- rubygems_version: 1.8.21
123
+ rubygems_version: 1.8.25
124
124
  signing_key:
125
125
  specification_version: 3
126
126
  summary: Google ID Token utilities