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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 826045ac18f5ab1acd04a13ac1985bb1d20e24fd62564aa3b004aca9de25e8f3
4
- data.tar.gz: d5a49f8b4678a44008b746e3d1a4d60ab8f9ba048e60e4e9c66e2578a8e40875
3
+ metadata.gz: bbc1fab8693b22933074cf7628973495a2cd9dad70f48a6039dd0aa9e6e4a9e0
4
+ data.tar.gz: d626c1cc206922aed6f69df8fb9353dbaca5b8e1f89b12a1dd7ebd05aeeae648
5
5
  SHA512:
6
- metadata.gz: 85aa97351bfe5033baf6bd484834123ca4681cd522beaf05c6722b466a34e72ead0d4e1c3fd8531aeae05eecba8b36f8b074f22c3900c9d79f01b504015be498
7
- data.tar.gz: 9284375080211ee4c2f217ea002b32cb31f1fe93235489e84c79165e5d08d0c2d1de3cd775cc1fc6b99962ab18337cff99a9c63dc8f6d609cb7475db6cba9b32
6
+ metadata.gz: 1714f3064415c04c515617f4fbcc262de6b51a5ed0102da442f79484756ee49d98b109b7edef7e21a4781afa760616602f3a8a0e161c6fd16db7c0d747829af7
7
+ data.tar.gz: d0299ed3bda7288b5386c6f9fda872108566c5b6eb9f6c69b9d2c26b6d3a49df476dc05563f4430e641df8fab8fbc2a9c581b26a157752ee4c7e76cb551b7d1e
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sorcery-jwt (0.1.2)
4
+ sorcery-jwt (0.1.6)
5
5
  jwt (~> 1.0)
6
6
  sorcery (~> 0.12.0)
7
7
 
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
  ```
@@ -1,5 +1,5 @@
1
1
  module Sorcery
2
2
  module Jwt
3
- VERSION = "0.1.5".freeze
3
+ VERSION = "0.1.6".freeze
4
4
  end
5
5
  end
@@ -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] = Time.now.to_i + (3600 * 24 * 14)
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.5
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-02-05 00:00:00.000000000 Z
11
+ date: 2019-04-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler