omniauth-jwt 0.0.1 → 0.0.2
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 +4 -4
- data/README.md +1 -1
- data/lib/omniauth/jwt/version.rb +1 -1
- data/lib/omniauth/strategies/jwt.rb +2 -2
- data/spec/lib/omniauth/strategies/jwt_spec.rb +6 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ecf33b5f8adbe1fc7e3899eb9dbd7527831f186
|
4
|
+
data.tar.gz: f3727295df8ef1115aeaadcad1fa29b62d03f2b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
* **
|
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']`
|
data/lib/omniauth/jwt/version.rb
CHANGED
@@ -12,7 +12,7 @@ module OmniAuth
|
|
12
12
|
|
13
13
|
option :secret, nil
|
14
14
|
option :algorithm, 'HS256'
|
15
|
-
option :
|
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.
|
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.
|
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-
|
11
|
+
date: 2013-10-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|