square-administration 2.2.0__py3-none-any.whl → 2.2.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- square_administration/routes/authentication.py +33 -0
- {square_administration-2.2.0.dist-info → square_administration-2.2.1.dist-info}/METADATA +6 -1
- {square_administration-2.2.0.dist-info → square_administration-2.2.1.dist-info}/RECORD +5 -5
- {square_administration-2.2.0.dist-info → square_administration-2.2.1.dist-info}/WHEEL +0 -0
- {square_administration-2.2.0.dist-info → square_administration-2.2.1.dist-info}/top_level.txt +0 -0
@@ -5,6 +5,7 @@ import bcrypt
|
|
5
5
|
from fastapi import APIRouter, status, HTTPException, Header, Request
|
6
6
|
from fastapi.responses import JSONResponse
|
7
7
|
from requests import HTTPError
|
8
|
+
from square_authentication_helper import TokenType
|
8
9
|
from square_commons import get_api_output_in_standard_format
|
9
10
|
from square_commons.api_utils import create_cookie
|
10
11
|
|
@@ -277,6 +278,22 @@ async def logout_v0(request: Request):
|
|
277
278
|
status_code=status.HTTP_400_BAD_REQUEST,
|
278
279
|
content=output_content,
|
279
280
|
)
|
281
|
+
refresh_token_payload = global_object_square_authentication_helper.validate_and_get_payload_from_token_v0(
|
282
|
+
refresh_token, TokenType.refresh_token
|
283
|
+
)[
|
284
|
+
"data"
|
285
|
+
][
|
286
|
+
"main"
|
287
|
+
]
|
288
|
+
if refresh_token_payload["app_id"] != global_int_app_id:
|
289
|
+
output_content = get_api_output_in_standard_format(
|
290
|
+
message=messages["INCORRECT_REFRESH_TOKEN"],
|
291
|
+
log=f"refresh token is for different app id. intended app id: {global_int_app_id}, actual app id: {refresh_token_payload['app_id']}.",
|
292
|
+
)
|
293
|
+
return JSONResponse(
|
294
|
+
status_code=status.HTTP_400_BAD_REQUEST,
|
295
|
+
content=output_content,
|
296
|
+
)
|
280
297
|
"""
|
281
298
|
main process
|
282
299
|
"""
|
@@ -345,6 +362,22 @@ async def generate_access_token_v0(
|
|
345
362
|
status_code=status.HTTP_400_BAD_REQUEST,
|
346
363
|
content=output_content,
|
347
364
|
)
|
365
|
+
refresh_token_payload = global_object_square_authentication_helper.validate_and_get_payload_from_token_v0(
|
366
|
+
refresh_token, TokenType.refresh_token
|
367
|
+
)[
|
368
|
+
"data"
|
369
|
+
][
|
370
|
+
"main"
|
371
|
+
]
|
372
|
+
if refresh_token_payload["app_id"] != global_int_app_id:
|
373
|
+
output_content = get_api_output_in_standard_format(
|
374
|
+
message=messages["INCORRECT_REFRESH_TOKEN"],
|
375
|
+
log=f"refresh token is for different app id. intended app id: {global_int_app_id}, actual app id: {refresh_token_payload['app_id']}.",
|
376
|
+
)
|
377
|
+
return JSONResponse(
|
378
|
+
status_code=status.HTTP_400_BAD_REQUEST,
|
379
|
+
content=output_content,
|
380
|
+
)
|
348
381
|
"""
|
349
382
|
main process
|
350
383
|
"""
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: square-administration
|
3
|
-
Version: 2.2.
|
3
|
+
Version: 2.2.1
|
4
4
|
Summary: common business layer for my personal server.
|
5
5
|
Home-page: https://github.com/thepmsquare/square_administration
|
6
6
|
Author: thePmSquare
|
@@ -42,6 +42,11 @@ pip install square_administration
|
|
42
42
|
|
43
43
|
## changelog
|
44
44
|
|
45
|
+
### v2.2.1
|
46
|
+
|
47
|
+
- authentication
|
48
|
+
- add validation for refresh token app id in logout_v0, generate_access_token_v0.
|
49
|
+
|
45
50
|
### v2.2.0
|
46
51
|
|
47
52
|
- authentication
|
@@ -7,10 +7,10 @@ square_administration/pydantic_models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCe
|
|
7
7
|
square_administration/pydantic_models/authentication.py,sha256=DWXctw5UWzkSVY7nMIQZsRhmgW3OK455OVcoUpJrPY0,202
|
8
8
|
square_administration/pydantic_models/core.py,sha256=HUMrBmfKrXeL-126gE5j2povdVmktn8XLg2tHEdeXTk,344
|
9
9
|
square_administration/routes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
10
|
-
square_administration/routes/authentication.py,sha256=
|
10
|
+
square_administration/routes/authentication.py,sha256=V1NZgee3IvQNzCjP4TdVDc-7sWNd2m7EjG1d3m-C7Yw,13383
|
11
11
|
square_administration/routes/core.py,sha256=65_FIZilintZvbHx7r25UQbgN-oKdQ92-Nv3kpwKX6s,5374
|
12
12
|
square_administration/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
13
|
-
square_administration-2.2.
|
14
|
-
square_administration-2.2.
|
15
|
-
square_administration-2.2.
|
16
|
-
square_administration-2.2.
|
13
|
+
square_administration-2.2.1.dist-info/METADATA,sha256=ygKKKDOhbGQUhkk2Caj2RfxtHB559qM43Q7VQoubMzk,1802
|
14
|
+
square_administration-2.2.1.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
15
|
+
square_administration-2.2.1.dist-info/top_level.txt,sha256=8WFipDrMQUPRDo5AvipxU1YK3wZtWZyCUMWaR416zAw,22
|
16
|
+
square_administration-2.2.1.dist-info/RECORD,,
|
File without changes
|
{square_administration-2.2.0.dist-info → square_administration-2.2.1.dist-info}/top_level.txt
RENAMED
File without changes
|