square-authentication 4.0.0__py3-none-any.whl → 4.1.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_authentication/routes/core.py +30 -24
- square_authentication/routes/utility.py +57 -1
- {square_authentication-4.0.0.dist-info → square_authentication-4.1.0.dist-info}/METADATA +9 -1
- {square_authentication-4.0.0.dist-info → square_authentication-4.1.0.dist-info}/RECORD +6 -6
- {square_authentication-4.0.0.dist-info → square_authentication-4.1.0.dist-info}/WHEEL +0 -0
- {square_authentication-4.0.0.dist-info → square_authentication-4.1.0.dist-info}/top_level.txt +0 -0
@@ -7,11 +7,11 @@ from fastapi import APIRouter, status, Header, HTTPException
|
|
7
7
|
from fastapi.responses import JSONResponse
|
8
8
|
from requests import HTTPError
|
9
9
|
from square_commons import get_api_output_in_standard_format
|
10
|
-
from
|
10
|
+
from square_database_helper.main import SquareDatabaseHelper
|
11
|
+
from square_database_helper.pydantic_models import (
|
11
12
|
FiltersV0,
|
12
13
|
FilterConditionsV0,
|
13
14
|
)
|
14
|
-
from square_database_helper.main import SquareDatabaseHelper
|
15
15
|
from square_database_structure.square import global_string_database_name
|
16
16
|
from square_database_structure.square.authentication import global_string_schema_name
|
17
17
|
from square_database_structure.square.authentication.tables import (
|
@@ -80,7 +80,7 @@ async def register_username_v0(
|
|
80
80
|
schema_name=global_string_schema_name,
|
81
81
|
table_name=UserCredential.__tablename__,
|
82
82
|
filters=FiltersV0(
|
83
|
-
{
|
83
|
+
root={
|
84
84
|
UserCredential.user_credential_username.name: FilterConditionsV0(
|
85
85
|
eq=username
|
86
86
|
)
|
@@ -223,7 +223,7 @@ async def register_username_v0(
|
|
223
223
|
schema_name=global_string_schema_name,
|
224
224
|
table_name=User.__tablename__,
|
225
225
|
filters=FiltersV0(
|
226
|
-
{User.user_id.name: FilterConditionsV0(eq=local_str_user_id)}
|
226
|
+
root={User.user_id.name: FilterConditionsV0(eq=local_str_user_id)}
|
227
227
|
),
|
228
228
|
)
|
229
229
|
output_content = get_api_output_in_standard_format(
|
@@ -265,7 +265,9 @@ async def get_user_details_v0(
|
|
265
265
|
database_name=global_string_database_name,
|
266
266
|
schema_name=global_string_schema_name,
|
267
267
|
table_name=UserApp.__tablename__,
|
268
|
-
filters=FiltersV0(
|
268
|
+
filters=FiltersV0(
|
269
|
+
root={UserApp.user_id.name: FilterConditionsV0(eq=user_id)}
|
270
|
+
),
|
269
271
|
)["data"]["main"]
|
270
272
|
local_list_response_user_credentials = (
|
271
273
|
global_object_square_database_helper.get_rows_v0(
|
@@ -273,7 +275,7 @@ async def get_user_details_v0(
|
|
273
275
|
schema_name=global_string_schema_name,
|
274
276
|
table_name=UserCredential.__tablename__,
|
275
277
|
filters=FiltersV0(
|
276
|
-
{UserCredential.user_id.name: FilterConditionsV0(eq=user_id)}
|
278
|
+
root={UserCredential.user_id.name: FilterConditionsV0(eq=user_id)}
|
277
279
|
),
|
278
280
|
)["data"]["main"]
|
279
281
|
)
|
@@ -283,7 +285,7 @@ async def get_user_details_v0(
|
|
283
285
|
schema_name=global_string_schema_name,
|
284
286
|
table_name=UserSession.__tablename__,
|
285
287
|
filters=FiltersV0(
|
286
|
-
{
|
288
|
+
root={
|
287
289
|
UserSession.user_id.name: FilterConditionsV0(eq=user_id),
|
288
290
|
UserSession.user_session_expiry_time.name: FilterConditionsV0(
|
289
291
|
gte=datetime.now(timezone.utc).isoformat()
|
@@ -393,7 +395,7 @@ async def update_user_app_ids_v0(
|
|
393
395
|
schema_name=global_string_public_schema_name,
|
394
396
|
table_name=App.__tablename__,
|
395
397
|
apply_filters=False,
|
396
|
-
filters=FiltersV0({}),
|
398
|
+
filters=FiltersV0(root={}),
|
397
399
|
)["data"]["main"]
|
398
400
|
local_list_invalid_ids = [
|
399
401
|
x
|
@@ -417,7 +419,9 @@ async def update_user_app_ids_v0(
|
|
417
419
|
database_name=global_string_database_name,
|
418
420
|
schema_name=global_string_schema_name,
|
419
421
|
table_name=UserApp.__tablename__,
|
420
|
-
filters=FiltersV0(
|
422
|
+
filters=FiltersV0(
|
423
|
+
root={UserApp.user_id.name: FilterConditionsV0(eq=user_id)}
|
424
|
+
),
|
421
425
|
)["data"]["main"]
|
422
426
|
local_list_new_app_ids = [
|
423
427
|
{
|
@@ -442,7 +446,7 @@ async def update_user_app_ids_v0(
|
|
442
446
|
schema_name=global_string_schema_name,
|
443
447
|
table_name=UserApp.__tablename__,
|
444
448
|
filters=FiltersV0(
|
445
|
-
{
|
449
|
+
root={
|
446
450
|
UserApp.user_id.name: FilterConditionsV0(eq=user_id),
|
447
451
|
UserApp.app_id.name: FilterConditionsV0(eq=app_id),
|
448
452
|
}
|
@@ -454,7 +458,7 @@ async def update_user_app_ids_v0(
|
|
454
458
|
schema_name=global_string_schema_name,
|
455
459
|
table_name=UserSession.__tablename__,
|
456
460
|
filters=FiltersV0(
|
457
|
-
{
|
461
|
+
root={
|
458
462
|
UserSession.user_id.name: FilterConditionsV0(eq=user_id),
|
459
463
|
UserSession.app_id.name: FilterConditionsV0(eq=app_id),
|
460
464
|
}
|
@@ -469,7 +473,9 @@ async def update_user_app_ids_v0(
|
|
469
473
|
database_name=global_string_database_name,
|
470
474
|
schema_name=global_string_schema_name,
|
471
475
|
table_name=UserApp.__tablename__,
|
472
|
-
filters=FiltersV0(
|
476
|
+
filters=FiltersV0(
|
477
|
+
root={UserApp.user_id.name: FilterConditionsV0(eq=user_id)}
|
478
|
+
),
|
473
479
|
)["data"]["main"]
|
474
480
|
output_content = get_api_output_in_standard_format(
|
475
481
|
message=messages["GENERIC_UPDATE_SUCCESSFUL"],
|
@@ -518,7 +524,7 @@ async def login_username_v0(body: LoginUsernameV0):
|
|
518
524
|
schema_name=global_string_schema_name,
|
519
525
|
table_name=UserCredential.__tablename__,
|
520
526
|
filters=FiltersV0(
|
521
|
-
{
|
527
|
+
root={
|
522
528
|
UserCredential.user_credential_username.name: FilterConditionsV0(
|
523
529
|
eq=username
|
524
530
|
)
|
@@ -546,7 +552,7 @@ async def login_username_v0(body: LoginUsernameV0):
|
|
546
552
|
schema_name=global_string_schema_name,
|
547
553
|
table_name=UserApp.__tablename__,
|
548
554
|
filters=FiltersV0(
|
549
|
-
{
|
555
|
+
root={
|
550
556
|
UserApp.user_id.name: FilterConditionsV0(eq=local_str_user_id),
|
551
557
|
UserApp.app_id.name: FilterConditionsV0(eq=app_id),
|
552
558
|
}
|
@@ -699,7 +705,7 @@ async def generate_access_token_v0(
|
|
699
705
|
schema_name=global_string_schema_name,
|
700
706
|
table_name=UserSession.__tablename__,
|
701
707
|
filters=FiltersV0(
|
702
|
-
{
|
708
|
+
root={
|
703
709
|
UserSession.user_session_refresh_token.name: FilterConditionsV0(
|
704
710
|
eq=refresh_token
|
705
711
|
),
|
@@ -789,7 +795,7 @@ async def logout_v0(
|
|
789
795
|
schema_name=global_string_schema_name,
|
790
796
|
table_name=UserSession.__tablename__,
|
791
797
|
filters=FiltersV0(
|
792
|
-
{
|
798
|
+
root={
|
793
799
|
UserSession.user_session_refresh_token.name: FilterConditionsV0(
|
794
800
|
eq=refresh_token
|
795
801
|
),
|
@@ -833,7 +839,7 @@ async def logout_v0(
|
|
833
839
|
schema_name=global_string_schema_name,
|
834
840
|
table_name=UserSession.__tablename__,
|
835
841
|
filters=FiltersV0(
|
836
|
-
{
|
842
|
+
root={
|
837
843
|
UserSession.user_session_refresh_token.name: FilterConditionsV0(
|
838
844
|
eq=refresh_token
|
839
845
|
),
|
@@ -896,7 +902,7 @@ async def update_username_v0(
|
|
896
902
|
schema_name=global_string_schema_name,
|
897
903
|
table_name=User.__tablename__,
|
898
904
|
filters=FiltersV0(
|
899
|
-
{
|
905
|
+
root={
|
900
906
|
User.user_id.name: FilterConditionsV0(eq=user_id),
|
901
907
|
}
|
902
908
|
),
|
@@ -918,7 +924,7 @@ async def update_username_v0(
|
|
918
924
|
schema_name=global_string_schema_name,
|
919
925
|
table_name=UserCredential.__tablename__,
|
920
926
|
filters=FiltersV0(
|
921
|
-
{
|
927
|
+
root={
|
922
928
|
UserCredential.user_credential_username.name: FilterConditionsV0(
|
923
929
|
eq=new_username
|
924
930
|
),
|
@@ -947,7 +953,7 @@ async def update_username_v0(
|
|
947
953
|
schema_name=global_string_schema_name,
|
948
954
|
table_name=UserCredential.__tablename__,
|
949
955
|
filters=FiltersV0(
|
950
|
-
{
|
956
|
+
root={
|
951
957
|
UserCredential.user_id.name: FilterConditionsV0(eq=user_id),
|
952
958
|
}
|
953
959
|
),
|
@@ -1014,7 +1020,7 @@ async def delete_user_v0(
|
|
1014
1020
|
schema_name=global_string_schema_name,
|
1015
1021
|
table_name=UserCredential.__tablename__,
|
1016
1022
|
filters=FiltersV0(
|
1017
|
-
{UserCredential.user_id.name: FilterConditionsV0(eq=user_id)}
|
1023
|
+
root={UserCredential.user_id.name: FilterConditionsV0(eq=user_id)}
|
1018
1024
|
),
|
1019
1025
|
)["data"]["main"]
|
1020
1026
|
)
|
@@ -1054,7 +1060,7 @@ async def delete_user_v0(
|
|
1054
1060
|
schema_name=global_string_schema_name,
|
1055
1061
|
table_name=User.__tablename__,
|
1056
1062
|
filters=FiltersV0(
|
1057
|
-
{
|
1063
|
+
root={
|
1058
1064
|
User.user_id.name: FilterConditionsV0(eq=user_id),
|
1059
1065
|
}
|
1060
1066
|
),
|
@@ -1119,7 +1125,7 @@ async def update_password_v0(
|
|
1119
1125
|
schema_name=global_string_schema_name,
|
1120
1126
|
table_name=UserCredential.__tablename__,
|
1121
1127
|
filters=FiltersV0(
|
1122
|
-
{UserCredential.user_id.name: FilterConditionsV0(eq=user_id)}
|
1128
|
+
root={UserCredential.user_id.name: FilterConditionsV0(eq=user_id)}
|
1123
1129
|
),
|
1124
1130
|
)["data"]["main"]
|
1125
1131
|
)
|
@@ -1162,7 +1168,7 @@ async def update_password_v0(
|
|
1162
1168
|
schema_name=global_string_schema_name,
|
1163
1169
|
table_name=UserCredential.__tablename__,
|
1164
1170
|
filters=FiltersV0(
|
1165
|
-
{
|
1171
|
+
root={
|
1166
1172
|
UserCredential.user_id.name: FilterConditionsV0(eq=user_id),
|
1167
1173
|
}
|
1168
1174
|
),
|
@@ -1,5 +1,61 @@
|
|
1
|
-
|
1
|
+
import bcrypt
|
2
|
+
from fastapi import APIRouter, status, HTTPException
|
3
|
+
from fastapi.responses import JSONResponse
|
4
|
+
from square_commons import get_api_output_in_standard_format
|
5
|
+
|
6
|
+
from square_authentication.configuration import global_object_square_logger
|
7
|
+
from square_authentication.messages import messages
|
2
8
|
|
3
9
|
router = APIRouter(
|
4
10
|
tags=["utility"],
|
5
11
|
)
|
12
|
+
|
13
|
+
|
14
|
+
@router.get("/get_text_hash/v0")
|
15
|
+
@global_object_square_logger.async_auto_logger
|
16
|
+
async def get_text_hash_v0(plain_text: str):
|
17
|
+
|
18
|
+
try:
|
19
|
+
"""
|
20
|
+
validation
|
21
|
+
"""
|
22
|
+
# pass
|
23
|
+
"""
|
24
|
+
main process
|
25
|
+
"""
|
26
|
+
local_str_hashed_text = bcrypt.hashpw(
|
27
|
+
plain_text.encode("utf-8"), bcrypt.gensalt()
|
28
|
+
).decode("utf-8")
|
29
|
+
"""
|
30
|
+
return value
|
31
|
+
"""
|
32
|
+
output_content = get_api_output_in_standard_format(
|
33
|
+
message=messages["GENERIC_READ_SUCCESSFUL"],
|
34
|
+
data={"main": local_str_hashed_text},
|
35
|
+
)
|
36
|
+
return JSONResponse(
|
37
|
+
status_code=status.HTTP_200_OK,
|
38
|
+
content=output_content,
|
39
|
+
)
|
40
|
+
except HTTPException as http_exception:
|
41
|
+
global_object_square_logger.logger.error(http_exception, exc_info=True)
|
42
|
+
"""
|
43
|
+
rollback logic
|
44
|
+
"""
|
45
|
+
# pass
|
46
|
+
return JSONResponse(
|
47
|
+
status_code=http_exception.status_code, content=http_exception.detail
|
48
|
+
)
|
49
|
+
except Exception as e:
|
50
|
+
global_object_square_logger.logger.error(e, exc_info=True)
|
51
|
+
"""
|
52
|
+
rollback logic
|
53
|
+
"""
|
54
|
+
# pass
|
55
|
+
output_content = get_api_output_in_standard_format(
|
56
|
+
message=messages["GENERIC_500"],
|
57
|
+
log=str(e),
|
58
|
+
)
|
59
|
+
return JSONResponse(
|
60
|
+
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, content=output_content
|
61
|
+
)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: square-authentication
|
3
|
-
Version: 4.
|
3
|
+
Version: 4.1.0
|
4
4
|
Summary: authentication layer for my personal server.
|
5
5
|
Home-page: https://github.com/thepmsquare/square_authentication
|
6
6
|
Author: thePmSquare
|
@@ -43,6 +43,14 @@ pip install square_authentication
|
|
43
43
|
|
44
44
|
## changelog
|
45
45
|
|
46
|
+
### v4.1.0
|
47
|
+
|
48
|
+
- add get_text_hash/v0 in utils.
|
49
|
+
|
50
|
+
### v4.0.1
|
51
|
+
|
52
|
+
- bugfix in pydantic model import.
|
53
|
+
|
46
54
|
### v4.0.0
|
47
55
|
|
48
56
|
- /login_username/v0 is now POST method.
|
@@ -6,12 +6,12 @@ square_authentication/data/config.ini,sha256=_740RvKpL5W2bUDGwZ7ePwuP-mAasr5cXXB
|
|
6
6
|
square_authentication/pydantic_models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
7
7
|
square_authentication/pydantic_models/core.py,sha256=Hwzr-YJH6GVGLp4Z29iHItOEhiEvk65MjsttmCaDTe4,431
|
8
8
|
square_authentication/routes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
9
|
-
square_authentication/routes/core.py,sha256=
|
10
|
-
square_authentication/routes/utility.py,sha256=
|
9
|
+
square_authentication/routes/core.py,sha256=Yki554LnBEv1RkwwPkSTksCbXMtgheka4_No41XVbe0,44742
|
10
|
+
square_authentication/routes/utility.py,sha256=ocLWj39JbKVOxgyTsM0xBUgTpHFmKIvvaT3UnjFvuOY,1783
|
11
11
|
square_authentication/utils/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
12
12
|
square_authentication/utils/encryption.py,sha256=T6BShoUr_xeGpbfPgTK-GxTlXPwcjwU4c4KW7KPzrF8,1865
|
13
13
|
square_authentication/utils/token.py,sha256=Y_arg5LegX-aprMj9YweUK8jjNZLGDjLUGgxbUA12w4,560
|
14
|
-
square_authentication-4.
|
15
|
-
square_authentication-4.
|
16
|
-
square_authentication-4.
|
17
|
-
square_authentication-4.
|
14
|
+
square_authentication-4.1.0.dist-info/METADATA,sha256=sLSqlgWDugaTf3y3APLXF9_xUDx5vO7CqmG6__hdr7c,2904
|
15
|
+
square_authentication-4.1.0.dist-info/WHEEL,sha256=bFJAMchF8aTQGUgMZzHJyDDMPTO3ToJ7x23SLJa1SVo,92
|
16
|
+
square_authentication-4.1.0.dist-info/top_level.txt,sha256=wDssVJIl9KIEJPj5rR3rv4uRI7yCndMBrvHd_6BGXQA,22
|
17
|
+
square_authentication-4.1.0.dist-info/RECORD,,
|
File without changes
|
{square_authentication-4.0.0.dist-info → square_authentication-4.1.0.dist-info}/top_level.txt
RENAMED
File without changes
|