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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 32c0fe6e79df5aa047efb8090326a8a4af67e561232f172183259d472d8e0611
4
- data.tar.gz: bdd91c0231f442fbf536682fb39764c641108e157c5f0eb725699ada5202bad3
3
+ metadata.gz: 2911cf57b0592928b95c2287afd70651c3930f4f915a8f70d52ee04b7bebda2e
4
+ data.tar.gz: d19b1b8e5c110b1b79982d13ce611631aa40afcaa0b16509734ef99f3b56c0c3
5
5
  SHA512:
6
- metadata.gz: 35c7e8e37ddc4e9ca06385697adaf9d7b23da9e02df603bb5a61974699a60301ba961d922a7b84427df85cc4fcf1ee5c30a9d8bb667ee7c8ca3b48b1af8652db
7
- data.tar.gz: 5c592ce396a2afecd24250909c08778efef069baf1ba8b8358a664b086c90bb8ed359aa6d61ccf4f7790934a33532b7503c38713c21b9312bdfc403796bf37e5
6
+ metadata.gz: 2e678b9cb79f608581bb993c3e63df9f6d82f30726fb4f3b5e7620dce30b93175cb9be4e6b8ab58504540af8d8d7a61c92f4bc6fa6fd3ea57ded6ad39c23687f
7
+ data.tar.gz: cee6cec0cdd8f22e8b9bf272b8d4dcffb6b0bb5520fbbf1c623b1ad420fcdd53be3eb66a6f0eaf143b0d62f8f8aac0f3f5481dcc2eadea2c8f099bdbdee026a5
data/.rubocop.yml CHANGED
@@ -1,5 +1,9 @@
1
1
  # inherit_from: .rubocop_todo.yml
2
+ require:
3
+ - rubocop-rake
4
+ - rubocop-rspec
2
5
  AllCops:
6
+ NewCops: enable
3
7
  Include:
4
8
  - '**/Gemfile'
5
9
  - '**/Rakefile'
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
 
@@ -1,3 +1,5 @@
1
+ require 'ostruct'
2
+
1
3
  module JWTKeeper
2
4
  class Configuration < OpenStruct
3
5
  DEFAULTS = {
@@ -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.3'.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.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: 2023-02-09 00:00:00.000000000 Z
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.0.3.1
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: