model_driven_api 2.3.17 → 2.3.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/json_web_token.rb +2 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '0185ee834ab4556b49df71082c7cff31f834e8c5a434f0add47763f8b4e3a0b5'
|
4
|
+
data.tar.gz: d0731f1d3485921ce34250f91e50ece42c4d1bc0a35378b881b24d6c711b9a31
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3558a4190736978ac74b84c43887907cde12785439bef08e18edd85b2c334e5d30e79b8b1c649552fc07ea20026d0da9c5167c796fbfcfd2b814fb1a7f25682a
|
7
|
+
data.tar.gz: 8bf646ed0e69761256895e60dffefa2c320d2bf6535ba0659c49e7f8d14107fafaa9ae53caeba31fb247364174cbfa52341c891d407b6c8cd62d2e88c6bebd42
|
data/lib/json_web_token.rb
CHANGED
@@ -3,7 +3,8 @@ class JsonWebToken
|
|
3
3
|
def encode(payload, expiry = 15.minutes.from_now.to_i)
|
4
4
|
result = ::JWT.encode(payload.merge(exp: expiry), ::Rails.application.credentials.dig(:secret_key_base).presence||ENV["SECRET_KEY_BASE"])
|
5
5
|
# Store the created token into the DB for later checks if is invalid
|
6
|
-
|
6
|
+
# In a public environment management, without login, it has no interest, so I don't pollute the DB
|
7
|
+
UsedToken.find_or_create_by(token: result, user_id: payload[:user_id]) if ENV["ALLOW_MULTISESSIONS"] == "false"
|
7
8
|
result
|
8
9
|
end
|
9
10
|
|