devise-jwt-cookie 0.4.0 → 0.5.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: d203b92171aba466360962313503055b1488613ec24a97e1acd88d5033d40ae1
4
- data.tar.gz: 35b0ba5f0930b43d25640e6c43b061d82fe038a6285e6ef57b0a89fcb89b6e36
3
+ metadata.gz: c7c6ec8c992497fb3b8b101513715de4316b61085cb32392e40d869016e90f06
4
+ data.tar.gz: 1530836791408926eaa4e7c955248b9aabda65d8d9b5e694492350e8113ca2c3
5
5
  SHA512:
6
- metadata.gz: 58acadb1fac0195e5cb48d33cd3da2a0dd8f0d3f5dd53e4d139e16e59b086e35ed994e8814c64791a93dc623ccca047a626e33d2aca58dd259d5da0fc01a8b57
7
- data.tar.gz: b00005d5a84121facaa1676c3664dbe3f28e094752308478233ff2fad7e421790344d5a8ac75ccdf0d4c54f5b67c3bc4b7517229f5f63d702b704e924424a878
6
+ metadata.gz: 4aec5355a7c0b152a3e67d7756a8b6f29969f072f939ca248c3d98d52505d4544a2e1426a6fc93fb1fbdcbb741f1699305a6c3eeba57f99897eeb581a5e5b025
7
+ data.tar.gz: 2a5640bc4e58fa33c4deebed85553ab0f4d568dfb32ca06aa24929ea093e33ec97ac3c8d77f8b4c85e9b2a9cc13df3f9e913acae1815a8776bcacb82878b0a87
data/README.md CHANGED
@@ -7,7 +7,7 @@
7
7
  Add this line to your application's Gemfile:
8
8
 
9
9
  ```ruby
10
- gem 'devise-jwt-cookie', '~> 0.2.0'
10
+ gem 'devise-jwt-cookie', '~> 0.4.0'
11
11
  ```
12
12
 
13
13
  And then execute:
@@ -12,11 +12,19 @@ module Devise
12
12
  end
13
13
 
14
14
  def call(env)
15
+ token_should_be_revoked = token_should_be_revoked?(env)
16
+ if token_should_be_revoked
17
+ # add the Authorization header, devise-jwt needs this to revoke tokens
18
+ # we need to make sure this is done before the other middleware is run
19
+ request = ActionDispatch::Request.new(env)
20
+ env['HTTP_AUTHORIZATION'] = "Bearer #{CookieHelper.new.read_from(request.cookies)}"
21
+ end
22
+
15
23
  status, headers, response = app.call(env)
16
24
  if headers['Authorization'] && env[ENV_KEY]
17
25
  name, cookie = CookieHelper.new.build(env[ENV_KEY])
18
26
  Rack::Utils.set_cookie_header!(headers, name, cookie)
19
- elsif token_should_be_revoked?(env)
27
+ elsif token_should_be_revoked
20
28
  name, cookie = CookieHelper.new.build(nil)
21
29
  Rack::Utils.set_cookie_header!(headers, name, cookie)
22
30
  end
@@ -1,7 +1,7 @@
1
1
  module Devise
2
2
  module JWT
3
3
  module Cookie
4
- VERSION = '0.4.0'
4
+ VERSION = '0.5.0'
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: devise-jwt-cookie
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Niels van der Zanden
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-04-15 00:00:00.000000000 Z
11
+ date: 2021-08-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: devise-jwt