omniauth-jwt 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b3551ff660ec977a58e338979ab86ca32ed4a2f6
4
- data.tar.gz: 37ba6b94e3f82189a64259adf4142f95d3b5798d
3
+ metadata.gz: 4ecf33b5f8adbe1fc7e3899eb9dbd7527831f186
4
+ data.tar.gz: f3727295df8ef1115aeaadcad1fa29b62d03f2b1
5
5
  SHA512:
6
- metadata.gz: 42b586ec5c268f2f07ffb887a95b2e7a8aae4f326821d17cbc30170e42bc9051be310f7f9a57873bdc420c573a798db61f8b39a423daf59e63b2182482323dda
7
- data.tar.gz: cb0d96261106ba6dd0475bc06cc609485be77a4c89e33e7337b8fecdf975d52b91cfa514258e87ddf9d92f184f8366d46662c8d015c827af78e003e07d5a14dd
6
+ metadata.gz: e13739e399c3ae5743d6a74af56fcbcbb52623044095c312ab4863c6aeb66cecc5700991105c1ca7d999192a63391bfc1ffe57faf51448b2eed27a0598ac62a1
7
+ data.tar.gz: 9a87df9e57ab6172b5604c9cd5feba61158524a5eef40b5f034b2fe98eb9a6bd0f28c4546f5cef5770f20f1ab47bdfa144103bd51fe77daf405a712fc49f24ed
data/README.md CHANGED
@@ -39,7 +39,7 @@ in. Other available options are:
39
39
 
40
40
  * **algorithm:** the algorithm to use to decode the JWT token. This is `HS256` by default but can
41
41
  be set to anything supported by [ruby-jwt](https://github.com/progrium/ruby-jwt)
42
- * **uid_key:** this determines which claim will be used to uniquely identify the user. Defaults
42
+ * **uid_claim:** this determines which claim will be used to uniquely identify the user. Defaults
43
43
  to `email`
44
44
  * **required_claims:** array of claims that are required to make this a valid authentication call.
45
45
  Defaults to `['name', 'email']`
@@ -1,5 +1,5 @@
1
1
  module Omniauth
2
2
  module JWT
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  end
@@ -12,7 +12,7 @@ module OmniAuth
12
12
 
13
13
  option :secret, nil
14
14
  option :algorithm, 'HS256'
15
- option :uid_key, 'email'
15
+ option :uid_claim, 'email'
16
16
  option :required_claims, %w(name email)
17
17
  option :info_map, {"name" => "name", "email" => "email"}
18
18
  option :auth_url, nil
@@ -38,7 +38,7 @@ module OmniAuth
38
38
  fail! :claim_invalid, e
39
39
  end
40
40
 
41
- uid{ decoded[options.uid_field] }
41
+ uid{ decoded[options.uid_claim] }
42
42
 
43
43
  extra do
44
44
  {:raw_info => decoded}
@@ -34,6 +34,12 @@ describe OmniAuth::Strategies::JWT do
34
34
  expect(last_response.status).to eq(302)
35
35
  end
36
36
 
37
+ it 'should assign the uid' do
38
+ encoded = JWT.encode({name: 'Steve', email: 'dude@awesome.com'}, 'imasecret')
39
+ get '/auth/jwt/callback?jwt=' + encoded
40
+ expect(response_json["uid"]).to eq('dude@awesome.com')
41
+ end
42
+
37
43
  context 'with a :valid_within option set' do
38
44
  let(:args){ ['imasecret', {auth_url: 'http://example.com/login', valid_within: 300}] }
39
45
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-jwt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Bleigh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-18 00:00:00.000000000 Z
11
+ date: 2013-10-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler