sorcery-jwt 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +2 -1
- data/lib/sorcery/jwt/version.rb +1 -1
- data/lib/sorcery/model/submodules/jwt.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bbc1fab8693b22933074cf7628973495a2cd9dad70f48a6039dd0aa9e6e4a9e0
|
4
|
+
data.tar.gz: d626c1cc206922aed6f69df8fb9353dbaca5b8e1f89b12a1dd7ebd05aeeae648
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1714f3064415c04c515617f4fbcc262de6b51a5ed0102da442f79484756ee49d98b109b7edef7e21a4781afa760616602f3a8a0e161c6fd16db7c0d747829af7
|
7
|
+
data.tar.gz: d0299ed3bda7288b5386c6f9fda872108566c5b6eb9f6c69b9d2c26b6d3a49df476dc05563f4430e641df8fab8fbc2a9c581b26a157752ee4c7e76cb551b7d1e
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -26,7 +26,7 @@ First, include the `:jwt` submodule in your list of configured Sorcery submodule
|
|
26
26
|
Rails.application.config.sorcery.submodules = [:jwt, ...]
|
27
27
|
```
|
28
28
|
|
29
|
-
Next, in the Sorcery `user_config`, set the secret and algorithm that will be used to sign your tokens
|
29
|
+
Next, in the Sorcery `user_config`, set the secret and algorithm that will be used to sign your tokens. You can also set length of time in seconds that the token will be valid for. Note that this is configured separately from the `:session_timeout` submodule.
|
30
30
|
|
31
31
|
```
|
32
32
|
Rails.application.config.sorcery.configure do |config|
|
@@ -35,6 +35,7 @@ Rails.application.config.sorcery.configure do |config|
|
|
35
35
|
# ...
|
36
36
|
user.jwt_secret = Rails.application.secrets.secret_key_base
|
37
37
|
user.jwt_algorithm = "HS256" # HS256 is used by default.
|
38
|
+
user.session_expiry = 60 * 60 * 24 * 7 * 2 # 2 weeks is used by default.
|
38
39
|
end
|
39
40
|
end
|
40
41
|
```
|
data/lib/sorcery/jwt/version.rb
CHANGED
@@ -17,7 +17,7 @@ module Sorcery
|
|
17
17
|
|
18
18
|
base.sorcery_config.instance_eval do
|
19
19
|
@defaults[:@jwt_algorithm] = "HS256"
|
20
|
-
@defaults[:@session_expiry] =
|
20
|
+
@defaults[:@session_expiry] = 60 * 60 * 24 * 7 * 2 # 2 weeks
|
21
21
|
|
22
22
|
reset!
|
23
23
|
end
|
@@ -30,7 +30,7 @@ module Sorcery
|
|
30
30
|
|
31
31
|
module ClassMethods
|
32
32
|
def issue_token(payload)
|
33
|
-
exp_payload = payload.merge(exp: @sorcery_config.session_expiry)
|
33
|
+
exp_payload = payload.merge(exp: Time.now.to_i + @sorcery_config.session_expiry)
|
34
34
|
JWT.encode(exp_payload, @sorcery_config.jwt_secret, @sorcery_config.jwt_algorithm)
|
35
35
|
end
|
36
36
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sorcery-jwt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hayden Luckenbach
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-04-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|