jwt_keeper 6.1.1 → 6.1.2
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/token.rb +6 -0
- data/lib/jwt_keeper/version.rb +1 -1
- data/spec/lib/jwt_keeper/token_spec.rb +20 -0
- data/spec/spec_helper.rb +2 -0
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2eeb8151e6cc1c98e0f6615305749ab7dec8528f1182df090e4894850a9107b5
|
4
|
+
data.tar.gz: 9226fc5af895edbb1c7516ac4702de326f7a351f167892eb1c9400d758e5d2d1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3651f6005aa6bbcbf5f0860bdffad0b1d3e0efa019234ec141c6d6d0f1e548fed86980b2ef78fb3fd899a5a358d43de9fb646688c889b9b9153242df8acd844e
|
7
|
+
data.tar.gz: 98cd11cf2e8b669941a39a64a5cc8c233a43fbe985eadf46103a57cbe7e2104281545caab0ea528f72e74345ad1a7a28da688557f90ef08981b21de911345e9f
|
data/lib/jwt_keeper/token.rb
CHANGED
@@ -63,6 +63,12 @@ module JWTKeeper
|
|
63
63
|
Datastore.revoke(token_jti, JWTKeeper.configuration.expiry.from_now.to_i)
|
64
64
|
end
|
65
65
|
|
66
|
+
# Checks if a web token has been revoked
|
67
|
+
# @return [Boolean]
|
68
|
+
def self.revoked?(token_jti)
|
69
|
+
Datastore.revoked?(token_jti)
|
70
|
+
end
|
71
|
+
|
66
72
|
# Easy interface for using the token's id
|
67
73
|
# @return [String] token's uuid
|
68
74
|
def id
|
data/lib/jwt_keeper/version.rb
CHANGED
@@ -108,6 +108,26 @@ module JWTKeeper
|
|
108
108
|
end
|
109
109
|
end
|
110
110
|
|
111
|
+
describe '.revoked?' do
|
112
|
+
let(:token_jti) { SecureRandom.uuid }
|
113
|
+
|
114
|
+
context 'with a revoked token' do
|
115
|
+
before { described_class.revoke(token_jti) }
|
116
|
+
|
117
|
+
it { expect(described_class.revoked?(token_jti)).to be true }
|
118
|
+
end
|
119
|
+
|
120
|
+
context 'with a pending token' do
|
121
|
+
before { described_class.rotate(token_jti) }
|
122
|
+
|
123
|
+
it { expect(described_class.revoked?(token_jti)).to be false }
|
124
|
+
end
|
125
|
+
|
126
|
+
context 'with a valid token' do
|
127
|
+
it { expect(described_class.revoked?(token_jti)).to be false }
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
111
131
|
describe '.rotate' do
|
112
132
|
subject(:token) { described_class.create(private_claims) }
|
113
133
|
before(:each) { described_class.rotate(token.id) }
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
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.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Rivera
|
8
8
|
- Zane Wolfgang Pickett
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2023-
|
12
|
+
date: 2023-03-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -248,7 +248,7 @@ homepage: https://github.com/sirwolfgang/jwt_keeper
|
|
248
248
|
licenses:
|
249
249
|
- MIT
|
250
250
|
metadata: {}
|
251
|
-
post_install_message:
|
251
|
+
post_install_message:
|
252
252
|
rdoc_options: []
|
253
253
|
require_paths:
|
254
254
|
- lib
|
@@ -263,8 +263,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
263
263
|
- !ruby/object:Gem::Version
|
264
264
|
version: '0'
|
265
265
|
requirements: []
|
266
|
-
rubygems_version: 3.
|
267
|
-
signing_key:
|
266
|
+
rubygems_version: 3.4.1
|
267
|
+
signing_key:
|
268
268
|
specification_version: 4
|
269
269
|
summary: JWT for Rails made easy
|
270
270
|
test_files:
|