jwt_keeper 6.1.3 → 6.1.4
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/lib/jwt_keeper/datastore.rb +10 -4
- data/lib/jwt_keeper/token.rb +2 -2
- data/lib/jwt_keeper/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0d1901227ea5255b17268496fa0deee68ba8decd6678b27f1736d032ca20d11f
|
4
|
+
data.tar.gz: ab809eb350f6ccc5468ab6a212a168df22a91634ec82c72b2186c5d3b360f668
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 12e91e2b843a5454e9ee7078022cae61a4dbddddad824affa5477a437a15ef2c420bf170d2b52ca341acfe41ff1d668b501d186651766aa36216df346c9903cd
|
7
|
+
data.tar.gz: a25ad9464740f2b331328c13aa11d4bb14ce18dc2c044133fbc64508002f96889971165d26827cc3937b85296828534c37c2a24beb36d03eb8a5a75f33ceecc6
|
data/lib/jwt_keeper/datastore.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
module JWTKeeper
|
2
2
|
module Datastore
|
3
|
+
PREFIX = 'JWTKeeper:'.freeze
|
4
|
+
|
3
5
|
class << self
|
4
6
|
# @!visibility private
|
5
7
|
def rotate(jti, seconds)
|
@@ -27,11 +29,13 @@ module JWTKeeper
|
|
27
29
|
|
28
30
|
# @!visibility private
|
29
31
|
def set_with_expiry(jti, seconds, type)
|
32
|
+
key = "#{PREFIX}#{jti}"
|
33
|
+
|
30
34
|
with_redis do |redis|
|
31
35
|
if redis.respond_to?(:call) # For RedisClient
|
32
|
-
redis.call('SETEX',
|
36
|
+
redis.call('SETEX', key, seconds, type)
|
33
37
|
elsif redis.respond_to?(:setex) # For Redis
|
34
|
-
redis.setex(
|
38
|
+
redis.setex(key, seconds, type)
|
35
39
|
else
|
36
40
|
throw 'Bad Redis Connection'
|
37
41
|
end
|
@@ -40,11 +44,13 @@ module JWTKeeper
|
|
40
44
|
|
41
45
|
# @!visibility private
|
42
46
|
def get(jti)
|
47
|
+
key = "#{PREFIX}#{jti}"
|
48
|
+
|
43
49
|
with_redis do |redis|
|
44
50
|
if redis.respond_to?(:call) # For RedisClient
|
45
|
-
redis.call('GET',
|
51
|
+
redis.call('GET', key)
|
46
52
|
elsif redis.respond_to?(:get) # For Redis
|
47
|
-
redis.get(
|
53
|
+
redis.get(key)
|
48
54
|
else
|
49
55
|
throw 'Bad Redis Connection'
|
50
56
|
end
|
data/lib/jwt_keeper/token.rb
CHANGED
@@ -53,14 +53,14 @@ module JWTKeeper
|
|
53
53
|
# @param token_jti [String] the token unique id
|
54
54
|
# @return [void]
|
55
55
|
def self.rotate(token_jti)
|
56
|
-
Datastore.rotate(token_jti, JWTKeeper.configuration.expiry.
|
56
|
+
Datastore.rotate(token_jti, JWTKeeper.configuration.expiry.to_i)
|
57
57
|
end
|
58
58
|
|
59
59
|
# Revokes a web token
|
60
60
|
# @param token_jti [String] the token unique id
|
61
61
|
# @return [void]
|
62
62
|
def self.revoke(token_jti)
|
63
|
-
Datastore.revoke(token_jti, JWTKeeper.configuration.expiry.
|
63
|
+
Datastore.revoke(token_jti, JWTKeeper.configuration.expiry.to_i)
|
64
64
|
end
|
65
65
|
|
66
66
|
# Checks if a web token has been revoked
|
data/lib/jwt_keeper/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jwt_keeper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.1.
|
4
|
+
version: 6.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Rivera
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2025-02-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -291,7 +291,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
291
291
|
- !ruby/object:Gem::Version
|
292
292
|
version: '0'
|
293
293
|
requirements: []
|
294
|
-
rubygems_version: 3.5.
|
294
|
+
rubygems_version: 3.5.22
|
295
295
|
signing_key:
|
296
296
|
specification_version: 4
|
297
297
|
summary: JWT for Rails made easy
|