File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed
Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -12,11 +12,19 @@ def initialize(app)
1212 end
1313
1414 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+
1523 status , headers , response = app . call ( env )
1624 if headers [ 'Authorization' ] && env [ ENV_KEY ]
1725 name , cookie = CookieHelper . new . build ( env [ ENV_KEY ] )
1826 Rack ::Utils . set_cookie_header! ( headers , name , cookie )
19- elsif token_should_be_revoked? ( env )
27+ elsif token_should_be_revoked
2028 name , cookie = CookieHelper . new . build ( nil )
2129 Rack ::Utils . set_cookie_header! ( headers , name , cookie )
2230 end
Original file line number Diff line number Diff line change 11module Devise
22 module JWT
33 module Cookie
4- VERSION = '0.4 .0'
4+ VERSION = '0.5 .0'
55 end
66 end
77end
You can’t perform that action at this time.
0 commit comments