square-administration 2.1.0__py3-none-any.whl → 2.2.0__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/messages.py +1 -0
- square_administration/routes/authentication.py +24 -7
- {square_administration-2.1.0.dist-info → square_administration-2.2.0.dist-info}/METADATA +6 -1
- {square_administration-2.1.0.dist-info → square_administration-2.2.0.dist-info}/RECORD +6 -6
- {square_administration-2.1.0.dist-info → square_administration-2.2.0.dist-info}/WHEEL +0 -0
- {square_administration-2.1.0.dist-info → square_administration-2.2.0.dist-info}/top_level.txt +0 -0
@@ -12,4 +12,5 @@ messages = {
|
|
12
12
|
"GENERIC_500": "an internal server error occurred. please try again later.",
|
13
13
|
"INCORRECT_ACCESS_TOKEN": "the access token provided is invalid or expired.",
|
14
14
|
"INCORRECT_REFRESH_TOKEN": "the refresh token provided is invalid or expired.",
|
15
|
+
"REFRESH_TOKEN_NOT_FOUND": "refresh token not found. please login again.",
|
15
16
|
}
|
@@ -2,7 +2,7 @@ import json
|
|
2
2
|
from typing import Annotated
|
3
3
|
|
4
4
|
import bcrypt
|
5
|
-
from fastapi import APIRouter, status, HTTPException, Header
|
5
|
+
from fastapi import APIRouter, status, HTTPException, Header, Request
|
6
6
|
from fastapi.responses import JSONResponse
|
7
7
|
from requests import HTTPError
|
8
8
|
from square_commons import get_api_output_in_standard_format
|
@@ -260,15 +260,23 @@ async def remove_app_for_self_v0(
|
|
260
260
|
|
261
261
|
@router.delete("/logout/v0")
|
262
262
|
@global_object_square_logger.async_auto_logger
|
263
|
-
async def logout_v0(
|
264
|
-
refresh_token: Annotated[str, Header()],
|
265
|
-
):
|
263
|
+
async def logout_v0(request: Request):
|
266
264
|
|
267
265
|
try:
|
268
266
|
"""
|
269
267
|
validation
|
270
268
|
"""
|
271
|
-
|
269
|
+
|
270
|
+
refresh_token = request.cookies.get("refresh_token|" + str(global_int_app_id))
|
271
|
+
if refresh_token is None:
|
272
|
+
output_content = get_api_output_in_standard_format(
|
273
|
+
message=messages["REFRESH_TOKEN_NOT_FOUND"],
|
274
|
+
log=f"refresh token not found.",
|
275
|
+
)
|
276
|
+
return JSONResponse(
|
277
|
+
status_code=status.HTTP_400_BAD_REQUEST,
|
278
|
+
content=output_content,
|
279
|
+
)
|
272
280
|
"""
|
273
281
|
main process
|
274
282
|
"""
|
@@ -320,14 +328,23 @@ async def logout_v0(
|
|
320
328
|
@router.get("/generate_access_token/v0")
|
321
329
|
@global_object_square_logger.async_auto_logger
|
322
330
|
async def generate_access_token_v0(
|
323
|
-
|
331
|
+
request: Request,
|
324
332
|
):
|
325
333
|
|
326
334
|
try:
|
327
335
|
"""
|
328
336
|
validation
|
329
337
|
"""
|
330
|
-
|
338
|
+
refresh_token = request.cookies.get("refresh_token|" + str(global_int_app_id))
|
339
|
+
if refresh_token is None:
|
340
|
+
output_content = get_api_output_in_standard_format(
|
341
|
+
message=messages["REFRESH_TOKEN_NOT_FOUND"],
|
342
|
+
log=f"refresh token not found.",
|
343
|
+
)
|
344
|
+
return JSONResponse(
|
345
|
+
status_code=status.HTTP_400_BAD_REQUEST,
|
346
|
+
content=output_content,
|
347
|
+
)
|
331
348
|
"""
|
332
349
|
main process
|
333
350
|
"""
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: square-administration
|
3
|
-
Version: 2.
|
3
|
+
Version: 2.2.0
|
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.0
|
46
|
+
|
47
|
+
- authentication
|
48
|
+
- logout_v0, generate_access_token_v0 remove refresh token from request header and accept in cookie.
|
49
|
+
|
45
50
|
### v2.1.0
|
46
51
|
|
47
52
|
- add authentication -> logout_v0, generate_access_token_v0.
|
@@ -1,16 +1,16 @@
|
|
1
1
|
square_administration/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
2
|
square_administration/configuration.py,sha256=ldSmVp3FWOndN4u-dH-pf4i0olRZx1-uORJAj1qW-g8,4733
|
3
3
|
square_administration/main.py,sha256=L4MM_7yimRLB8J1ltgXPnrN3j_UXKVtp8o8S46MSqrY,1678
|
4
|
-
square_administration/messages.py,sha256=
|
4
|
+
square_administration/messages.py,sha256=VYjJGW0Kvtjrx1Mw7ekksLVMoxcexLol2OckvqhZ3n0,1063
|
5
5
|
square_administration/data/config.ini,sha256=NMpUnBSPEdwCW1Y-z5DOjpTQgXGjt4ZcqP4QQiAXr_U,997
|
6
6
|
square_administration/pydantic_models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
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=jGyQJkX6LMnNbOFqbWdEyOnMGUHNdK-PoeGriTNt-XM,11862
|
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.
|
14
|
-
square_administration-2.
|
15
|
-
square_administration-2.
|
16
|
-
square_administration-2.
|
13
|
+
square_administration-2.2.0.dist-info/METADATA,sha256=jKs3X8MSBrYx4YGeC-P7_arkADCzp29S8p7JMz4tN-k,1686
|
14
|
+
square_administration-2.2.0.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
15
|
+
square_administration-2.2.0.dist-info/top_level.txt,sha256=8WFipDrMQUPRDo5AvipxU1YK3wZtWZyCUMWaR416zAw,22
|
16
|
+
square_administration-2.2.0.dist-info/RECORD,,
|
File without changes
|
{square_administration-2.1.0.dist-info → square_administration-2.2.0.dist-info}/top_level.txt
RENAMED
File without changes
|