jwt_keeper 3.2.0 → 3.3.0

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: 5313f67290a724013407952cecbc2c8df761ccc32d105df14ddf377433270283
4
- data.tar.gz: a71960bcace03b25fd0bb2d58256a34138197e432a2b7fef0db88bc33264f3e1
3
+ metadata.gz: b2c902b7848d7fe72b7ad437badc5cf549b299d4b2ae2dc9150b7f42d63855a3
4
+ data.tar.gz: 77a18a0cfeb2b198f13affa3792feaeb1235d5fa2f6ae599038bb3e2245b41b2
5
5
  SHA512:
6
- metadata.gz: 316164c515d750a2dafffb9c070412ec3eedaef7240748dac61e4b623e7edb7f772feffced56b9e269bc545e69fe07f58df5868cb8348c4664675c2a16650c23
7
- data.tar.gz: 1798c936fa86de719cc95915c6a32fa4c0d94b8337b6a56fe3f8cf48556d4f7ebc3224a66b712f288f0e31b12a21cf573c75a5c167df40b40cc229530cb9de9c
6
+ metadata.gz: bc177da58d088bdaeeba97049628d0908f05ef9bd717674a34b511a14e70289604a87647c01853ec3aeb988fb80cd95f4c4a96d0741a1133efc72f2138b9bd98
7
+ data.tar.gz: 97dde3b11a5584357028abb7d9523d548c53ccb8e0211a4b31089f177747c1d9fca7521bf4984837a540ec2c46080a51adacd30e322fcd4408e6d8d732cad21e
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  gemspec
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bundler/gem_tasks'
2
4
  require 'rspec/core/rake_task'
3
5
 
@@ -23,13 +23,14 @@ Gem::Specification.new do |spec|
23
23
  spec.add_development_dependency 'yard'
24
24
  spec.add_development_dependency 'rubocop'
25
25
  spec.add_development_dependency 'dotenv'
26
+ spec.add_development_dependency 'pry'
26
27
 
27
28
  spec.add_development_dependency 'rspec', '~> 3.8'
28
29
  spec.add_development_dependency 'fuubar'
29
30
  spec.add_development_dependency 'simplecov'
30
31
 
31
32
  spec.add_dependency 'redis'
32
- spec.add_dependency 'rails', '~> 5.0'
33
- spec.add_dependency 'activesupport', '~> 5.0'
33
+ spec.add_dependency 'rails'
34
+ spec.add_dependency 'activesupport'
34
35
  spec.add_dependency 'jwt', '>= 1.5'
35
36
  end
@@ -17,6 +17,7 @@ module JWTKeeper
17
17
  }
18
18
  @claims.merge!(JWTKeeper.configuration.base_claims)
19
19
  @claims.merge!(private_claims)
20
+ @claims[:exp] = @claims[:exp].to_i if @claims[:exp].is_a?(Time)
20
21
  end
21
22
 
22
23
  # Creates a new web token
@@ -1,4 +1,4 @@
1
1
  # Gem Version
2
2
  module JWTKeeper
3
- VERSION = '3.2.0'.freeze
3
+ VERSION = '3.3.0'.freeze
4
4
  end
@@ -4,7 +4,7 @@ RSpec.describe JWTKeeper do
4
4
  describe 'Controller' do
5
5
  include_context 'initialize config'
6
6
 
7
- let(:token) { JWTKeeper::Token.create(claim: "Jet fuel can't melt steel beams") }
7
+ let(:token) { JWTKeeper::Token.create(claim: "The Earth is Flat") }
8
8
  subject(:test_controller) do
9
9
  cookies_klass = Class.new(Hash) do
10
10
  def signed
@@ -3,7 +3,7 @@ require 'spec_helper'
3
3
  module JWTKeeper
4
4
  RSpec.describe Token do
5
5
  include_context 'initialize config'
6
- let(:private_claims) { { claim: "Jet fuel can't melt steel beams" } }
6
+ let(:private_claims) { { claim: "The Earth is Flat" } }
7
7
  let(:token) { described_class.create(private_claims) }
8
8
  let(:raw_token) { token.to_jwt }
9
9
 
@@ -42,16 +42,23 @@ module JWTKeeper
42
42
  it { is_expected.to be nil }
43
43
  end
44
44
 
45
- context 'with bad cookie' do
46
- subject { described_class.find(raw_token, 'BAD_COOKIE') }
47
- it { is_expected.to be nil }
48
- end
49
-
50
- context 'with valid cookie' do
45
+ context 'describe with cookie locking' do
51
46
  before { JWTKeeper.configure(JWTKeeper::Configuration.new(config.merge(cookie_lock: true))) }
52
- subject { described_class.find(raw_token, token.cookie_secret) }
53
47
 
54
- it { is_expected.to be_instance_of described_class }
48
+ context 'with no cookie' do
49
+ subject { described_class.find(raw_token, nil) }
50
+ it { is_expected.to be nil }
51
+ end
52
+
53
+ context 'with bad cookie' do
54
+ subject { described_class.find(raw_token, 'BAD_COOKIE') }
55
+ it { is_expected.to be nil }
56
+ end
57
+
58
+ context 'with valid cookie' do
59
+ subject { described_class.find(raw_token, token.cookie_secret) }
60
+ it { is_expected.to be_instance_of described_class }
61
+ end
55
62
  end
56
63
  end
57
64
 
@@ -1,3 +1,4 @@
1
+ require 'pry'
1
2
  require 'dotenv'
2
3
  Dotenv.load
3
4
 
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: 3.2.0
4
+ version: 3.3.0
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: 2019-02-06 00:00:00.000000000 Z
12
+ date: 2020-12-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -81,6 +81,20 @@ dependencies:
81
81
  - - ">="
82
82
  - !ruby/object:Gem::Version
83
83
  version: '0'
84
+ - !ruby/object:Gem::Dependency
85
+ name: pry
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'
84
98
  - !ruby/object:Gem::Dependency
85
99
  name: rspec
86
100
  requirement: !ruby/object:Gem::Requirement
@@ -141,30 +155,30 @@ dependencies:
141
155
  name: rails
142
156
  requirement: !ruby/object:Gem::Requirement
143
157
  requirements:
144
- - - "~>"
158
+ - - ">="
145
159
  - !ruby/object:Gem::Version
146
- version: '5.0'
160
+ version: '0'
147
161
  type: :runtime
148
162
  prerelease: false
149
163
  version_requirements: !ruby/object:Gem::Requirement
150
164
  requirements:
151
- - - "~>"
165
+ - - ">="
152
166
  - !ruby/object:Gem::Version
153
- version: '5.0'
167
+ version: '0'
154
168
  - !ruby/object:Gem::Dependency
155
169
  name: activesupport
156
170
  requirement: !ruby/object:Gem::Requirement
157
171
  requirements:
158
- - - "~>"
172
+ - - ">="
159
173
  - !ruby/object:Gem::Version
160
- version: '5.0'
174
+ version: '0'
161
175
  type: :runtime
162
176
  prerelease: false
163
177
  version_requirements: !ruby/object:Gem::Requirement
164
178
  requirements:
165
- - - "~>"
179
+ - - ">="
166
180
  - !ruby/object:Gem::Version
167
- version: '5.0'
181
+ version: '0'
168
182
  - !ruby/object:Gem::Dependency
169
183
  name: jwt
170
184
  requirement: !ruby/object:Gem::Requirement
@@ -220,7 +234,7 @@ homepage: https://github.com/sirwolfgang/jwt_keeper
220
234
  licenses:
221
235
  - MIT
222
236
  metadata: {}
223
- post_install_message:
237
+ post_install_message:
224
238
  rdoc_options: []
225
239
  require_paths:
226
240
  - lib
@@ -235,9 +249,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
235
249
  - !ruby/object:Gem::Version
236
250
  version: '0'
237
251
  requirements: []
238
- rubyforge_project:
239
- rubygems_version: 2.7.6
240
- signing_key:
252
+ rubygems_version: 3.1.4
253
+ signing_key:
241
254
  specification_version: 4
242
255
  summary: JWT for Rails made easy
243
256
  test_files: