jwt-auth 2.0.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -0
- data/lib/jwt/auth/token.rb +3 -1
- data/lib/jwt/auth/version.rb +1 -1
- 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: b41cd772fd3da17cae17a45c21f90686d17d0cfd
|
4
|
+
data.tar.gz: 11722c972099efd07ea4bc4311fc57a6e3c45d88
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e40395a5846af7338bc32bd9f9812d20b7fe2e9c19a5a33eda0ff2bddd0b3dfb7c742366ad5a6f7f455a0d66d1ebc04df7b7cd6da86f41538be362387555c507
|
7
|
+
data.tar.gz: 954162e9bdb932df424d6812b574b0eaf5734802ed1f4dc42d46ace4a89288af4229926480501888c6dfe6481a99daf9dd7cb9c4cae596265ede5024002dd2a5
|
data/README.md
CHANGED
@@ -42,6 +42,14 @@ class User < ApplicationRecord
|
|
42
42
|
end
|
43
43
|
```
|
44
44
|
|
45
|
+
Optionally, define the `find_by_token` method on your model to allow additional checks (for example account activation):
|
46
|
+
|
47
|
+
```ruby
|
48
|
+
def self.find_by_token(params)
|
49
|
+
find_by params.merge :activated => true
|
50
|
+
end
|
51
|
+
```
|
52
|
+
|
45
53
|
Add a `token_version` field to your user model:
|
46
54
|
|
47
55
|
```ruby
|
data/lib/jwt/auth/token.rb
CHANGED
@@ -41,7 +41,9 @@ module JWT
|
|
41
41
|
|
42
42
|
token = JWT::Auth::Token.new
|
43
43
|
token.expiration = payload['exp']
|
44
|
-
|
44
|
+
|
45
|
+
find_method = JWT::Auth.model.respond_to?(:find_by_token) ? :find_by_token : :find_by
|
46
|
+
token.subject = JWT::Auth.model.send find_method, :id => payload['sub'], :token_version => payload['ver']
|
45
47
|
|
46
48
|
token
|
47
49
|
end
|
data/lib/jwt/auth/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jwt-auth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Florian Dejonckheere
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-04-
|
11
|
+
date: 2017-04-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jwt
|