jwt_keeper 6.1.1 → 6.1.2

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: 32c0fe6e79df5aa047efb8090326a8a4af67e561232f172183259d472d8e0611
4
- data.tar.gz: bdd91c0231f442fbf536682fb39764c641108e157c5f0eb725699ada5202bad3
3
+ metadata.gz: 2eeb8151e6cc1c98e0f6615305749ab7dec8528f1182df090e4894850a9107b5
4
+ data.tar.gz: 9226fc5af895edbb1c7516ac4702de326f7a351f167892eb1c9400d758e5d2d1
5
5
  SHA512:
6
- metadata.gz: 35c7e8e37ddc4e9ca06385697adaf9d7b23da9e02df603bb5a61974699a60301ba961d922a7b84427df85cc4fcf1ee5c30a9d8bb667ee7c8ca3b48b1af8652db
7
- data.tar.gz: 5c592ce396a2afecd24250909c08778efef069baf1ba8b8358a664b086c90bb8ed359aa6d61ccf4f7790934a33532b7503c38713c21b9312bdfc403796bf37e5
6
+ metadata.gz: 3651f6005aa6bbcbf5f0860bdffad0b1d3e0efa019234ec141c6d6d0f1e548fed86980b2ef78fb3fd899a5a358d43de9fb646688c889b9b9153242df8acd844e
7
+ data.tar.gz: 98cd11cf2e8b669941a39a64a5cc8c233a43fbe985eadf46103a57cbe7e2104281545caab0ea528f72e74345ad1a7a28da688557f90ef08981b21de911345e9f
@@ -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
@@ -1,4 +1,4 @@
1
1
  # Gem Version
2
2
  module JWTKeeper
3
- VERSION = '6.1.1'.freeze
3
+ VERSION = '6.1.2'.freeze
4
4
  end
@@ -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
@@ -11,6 +11,8 @@ end
11
11
 
12
12
  require 'rails'
13
13
  require 'jwt_keeper'
14
+ require 'redis-client'
15
+ require 'redis'
14
16
 
15
17
  RSpec.configure do |config|
16
18
  config.expect_with :rspec do |expectations|
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.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-02-09 00:00:00.000000000 Z
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.0.3.1
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: