4
4
import uuid
5
5
from functools import wraps
6
6
7
- from flask import Response , _request_ctx_stack , redirect , request
7
+ from flask import Response , redirect , request , g
8
8
9
9
from .. import (
10
10
COOKIE_DATA_NAME ,
@@ -143,7 +143,7 @@ def decorated(*args, **kwargs):
143
143
return Response ("Access denied" , 401 )
144
144
145
145
# Save the claims on the context execute the original API
146
- _request_ctx_stack . top .claims = jwt_response
146
+ g .claims = jwt_response
147
147
response = f (* args , ** kwargs )
148
148
149
149
if jwt_response .get (COOKIE_DATA_NAME , None ):
@@ -181,7 +181,7 @@ def decorated(*args, **kwargs):
181
181
return Response ("Unauthorized" , 401 )
182
182
183
183
# Save the claims on the context execute the original API
184
- _request_ctx_stack . top .claims = jwt_response
184
+ g .claims = jwt_response
185
185
response = f (* args , ** kwargs )
186
186
187
187
set_cookie_on_response (
@@ -194,7 +194,6 @@ def decorated(*args, **kwargs):
194
194
jwt_response [REFRESH_SESSION_TOKEN_NAME ],
195
195
jwt_response [COOKIE_DATA_NAME ],
196
196
)
197
-
198
197
return response
199
198
200
199
return decorated
@@ -224,7 +223,7 @@ def decorated(*args, **kwargs):
224
223
return Response ("Unauthorized" , 401 )
225
224
226
225
# Save the claims on the context execute the original API
227
- _request_ctx_stack . top .claims = jwt_response
226
+ g .claims = jwt_response
228
227
response = f (* args , ** kwargs )
229
228
230
229
set_cookie_on_response (
@@ -267,7 +266,7 @@ def decorated(*args, **kwargs):
267
266
return Response ("Unauthorized" , 401 )
268
267
269
268
# Save the claims on the context execute the original API
270
- _request_ctx_stack . top .claims = jwt_response
269
+ g .claims = jwt_response
271
270
response = f (* args , ** kwargs )
272
271
273
272
set_cookie_on_response (
@@ -310,7 +309,7 @@ def decorated(*args, **kwargs):
310
309
return Response ("Unauthorized" , 401 )
311
310
312
311
# Save the claims on the context execute the original API
313
- _request_ctx_stack . top .claims = jwt_response
312
+ g .claims = jwt_response
314
313
response = f (* args , ** kwargs )
315
314
316
315
set_cookie_on_response (
@@ -400,7 +399,7 @@ def decorated(*args, **kwargs):
400
399
return Response ("Unauthorized" , 401 )
401
400
402
401
# Save the claims on the context execute the original API
403
- _request_ctx_stack . top .claims = jwt_response
402
+ g .claims = jwt_response
404
403
response = f (* args , ** kwargs )
405
404
406
405
set_cookie_on_response (
0 commit comments