goinstant-auth 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b64d109a313ee934d909d3d4d06e18b38d98ef4d
4
- data.tar.gz: aa886d669d80765a57bbdccc6d6ec01ea42b2d9b
3
+ metadata.gz: ece982eb543cf491416f08cd1cff63509eea34f7
4
+ data.tar.gz: 8402ece4abd227452b740af351f89fda65df8136
5
5
  SHA512:
6
- metadata.gz: 2d3278b314977b0b261ecd593754307d71415c96d48dd8ce669fd24f1fb2b926fbf1b4072d7e70077ad9bb5816bad639554c8bd5167ce4799bc788761bc7787d
7
- data.tar.gz: df325d49b0b9fe4f241de53fbc1ce105265acd879e70ae3885776e3dfa02ec3cb1d0f33b9c1e8a3be7500cb75b9ff5b86e77d1f2352a4922ef8a43820528db2c
6
+ metadata.gz: 2671e0dc1a84f7fa3dfa2457386b0dac0466982d33853046377352ba5d31dfb2c519d8074c2f8d87c1a804dd61108f5a6eb5c76a6b90182b1ee8ce2371d62caf
7
+ data.tar.gz: 25d6fe15a5ee8db2ac9cd4511414efc2bddf822257de0f8e9385a153ee18e352f8befadb0b6e74d3b4aea5d08697b9204672961b312534300c166394ae542507
@@ -56,6 +56,7 @@ module GoInstant
56
56
  Signer.map_required_claims(claims, REQUIRED_CLAIMS)
57
57
  Signer.map_optional_claims(claims, OPTIONAL_CLAIMS)
58
58
  claims[:aud] = 'goinstant.net'
59
+ claims[:sub] = claims[:sub].to_s
59
60
 
60
61
  if claims.has_key?(:g) then
61
62
  groups = claims[:g]
@@ -68,6 +69,8 @@ module GoInstant
68
69
  msg = "group #{i} missing required key: %s"
69
70
  i += 1
70
71
  Signer.map_required_claims(group, REQUIRED_GROUP_CLAIMS, msg)
72
+ group[:id] = group[:id].to_s
73
+ group
71
74
  end
72
75
  else
73
76
  claims[:g] = []
@@ -178,10 +178,34 @@ describe GoInstant::Auth::Signer do
178
178
  'iss' => 'example.com',
179
179
  'dn' => 'bob',
180
180
  'g' => [
181
- { 'id' => 1234, 'dn' => 'Group 1234' },
182
- { 'id' => 42, 'dn' => 'Meaning Group' }
181
+ { 'id' => '1234', 'dn' => 'Group 1234' },
182
+ { 'id' => '42', 'dn' => 'Meaning Group' }
183
183
  ]
184
- }, '5isd3i1A4so7MwKm0VHWYHuWRy3WwGFipO0kkelNRLU')
184
+ }, 'do67aKlXv2x5LZa_SWPv-Lbz0d3e2Mwn-H8WrDIDutA')
185
+ end
186
+
187
+ it 'coerces id to strings' do
188
+ user_data = {
189
+ :id => 12345, #int
190
+ :domain => 'example.com',
191
+ :display_name => 'bob',
192
+ :groups => [
193
+ { :id => 1234, :display_name => 'Group 1234' },
194
+ { :id => 42, :display_name => 'Meaning Group' }
195
+ ]
196
+ }
197
+
198
+ jwt = @signer.sign(user_data)
199
+ validate_jwt(jwt, {
200
+ 'aud' => 'goinstant.net',
201
+ 'sub' => '12345',
202
+ 'iss' => 'example.com',
203
+ 'dn' => 'bob',
204
+ 'g' => [
205
+ { 'id' => '1234', 'dn' => 'Group 1234' },
206
+ { 'id' => '42', 'dn' => 'Meaning Group' }
207
+ ]
208
+ }, '3NvnJpacWHj7BDC3NL00aKNcncZp8jyL-IO1B27ITzI')
185
209
  end
186
210
  end
187
211
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: goinstant-auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - GoInstant Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-26 00:00:00.000000000 Z
11
+ date: 2014-02-08 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Lets your users log-in to your GoInstant app
14
14
  email: support@goinstant.org