jwt_keeper 6.1.1 → 6.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +4 -0
- data/jwt_keeper.gemspec +2 -0
- data/lib/jwt_keeper/configuration.rb +2 -0
- 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 +34 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2911cf57b0592928b95c2287afd70651c3930f4f915a8f70d52ee04b7bebda2e
|
4
|
+
data.tar.gz: d19b1b8e5c110b1b79982d13ce611631aa40afcaa0b16509734ef99f3b56c0c3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e678b9cb79f608581bb993c3e63df9f6d82f30726fb4f3b5e7620dce30b93175cb9be4e6b8ab58504540af8d8d7a61c92f4bc6fa6fd3ea57ded6ad39c23687f
|
7
|
+
data.tar.gz: cee6cec0cdd8f22e8b9bf272b8d4dcffb6b0bb5520fbbf1c623b1ad420fcdd53be3eb66a6f0eaf143b0d62f8f8aac0f3f5481dcc2eadea2c8f099bdbdee026a5
|
data/.rubocop.yml
CHANGED
data/jwt_keeper.gemspec
CHANGED
@@ -22,6 +22,8 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.add_development_dependency 'rake'
|
23
23
|
spec.add_development_dependency 'yard'
|
24
24
|
spec.add_development_dependency 'rubocop'
|
25
|
+
spec.add_development_dependency 'rubocop-rake'
|
26
|
+
spec.add_development_dependency 'rubocop-rspec'
|
25
27
|
spec.add_development_dependency 'dotenv'
|
26
28
|
spec.add_development_dependency 'pry'
|
27
29
|
|
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.3
|
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:
|
12
|
+
date: 2024-07-31 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -67,6 +67,34 @@ dependencies:
|
|
67
67
|
- - ">="
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
version: '0'
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: rubocop-rake
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - ">="
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '0'
|
84
|
+
- !ruby/object:Gem::Dependency
|
85
|
+
name: rubocop-rspec
|
86
|
+
requirement: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
91
|
+
type: :development
|
92
|
+
prerelease: false
|
93
|
+
version_requirements: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - ">="
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0'
|
70
98
|
- !ruby/object:Gem::Dependency
|
71
99
|
name: dotenv
|
72
100
|
requirement: !ruby/object:Gem::Requirement
|
@@ -248,7 +276,7 @@ homepage: https://github.com/sirwolfgang/jwt_keeper
|
|
248
276
|
licenses:
|
249
277
|
- MIT
|
250
278
|
metadata: {}
|
251
|
-
post_install_message:
|
279
|
+
post_install_message:
|
252
280
|
rdoc_options: []
|
253
281
|
require_paths:
|
254
282
|
- lib
|
@@ -263,8 +291,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
263
291
|
- !ruby/object:Gem::Version
|
264
292
|
version: '0'
|
265
293
|
requirements: []
|
266
|
-
rubygems_version: 3.
|
267
|
-
signing_key:
|
294
|
+
rubygems_version: 3.5.11
|
295
|
+
signing_key:
|
268
296
|
specification_version: 4
|
269
297
|
summary: JWT for Rails made easy
|
270
298
|
test_files:
|