square-authentication 5.1.3__tar.gz → 5.1.5__tar.gz
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-5.1.3 → square_authentication-5.1.5}/PKG-INFO +31 -6
- {square_authentication-5.1.3 → square_authentication-5.1.5}/README.md +8 -0
- {square_authentication-5.1.3 → square_authentication-5.1.5}/setup.py +2 -2
- {square_authentication-5.1.3 → square_authentication-5.1.5}/square_authentication/main.py +1 -1
- {square_authentication-5.1.3 → square_authentication-5.1.5}/square_authentication/routes/core.py +39 -28
- {square_authentication-5.1.3 → square_authentication-5.1.5}/square_authentication/routes/utility.py +1 -1
- {square_authentication-5.1.3 → square_authentication-5.1.5}/square_authentication/utils/encryption.py +2 -2
- {square_authentication-5.1.3 → square_authentication-5.1.5}/square_authentication/utils/token.py +1 -1
- {square_authentication-5.1.3 → square_authentication-5.1.5}/square_authentication.egg-info/PKG-INFO +32 -7
- {square_authentication-5.1.3 → square_authentication-5.1.5}/square_authentication.egg-info/SOURCES.txt +2 -1
- {square_authentication-5.1.3 → square_authentication-5.1.5}/square_authentication.egg-info/requires.txt +1 -1
- square_authentication-5.1.5/tests/test_1.py +17 -0
- {square_authentication-5.1.3 → square_authentication-5.1.5}/setup.cfg +0 -0
- {square_authentication-5.1.3 → square_authentication-5.1.5}/square_authentication/__init__.py +0 -0
- {square_authentication-5.1.3 → square_authentication-5.1.5}/square_authentication/configuration.py +0 -0
- {square_authentication-5.1.3 → square_authentication-5.1.5}/square_authentication/data/config.ini +0 -0
- {square_authentication-5.1.3 → square_authentication-5.1.5}/square_authentication/messages.py +0 -0
- {square_authentication-5.1.3 → square_authentication-5.1.5}/square_authentication/pydantic_models/__init__.py +0 -0
- {square_authentication-5.1.3 → square_authentication-5.1.5}/square_authentication/pydantic_models/core.py +0 -0
- {square_authentication-5.1.3 → square_authentication-5.1.5}/square_authentication/routes/__init__.py +0 -0
- {square_authentication-5.1.3 → square_authentication-5.1.5}/square_authentication/utils/__init__.py +0 -0
- {square_authentication-5.1.3 → square_authentication-5.1.5}/square_authentication.egg-info/dependency_links.txt +0 -0
- {square_authentication-5.1.3 → square_authentication-5.1.5}/square_authentication.egg-info/top_level.txt +0 -0
@@ -1,18 +1,37 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.4
|
2
2
|
Name: square_authentication
|
3
|
-
Version: 5.1.
|
3
|
+
Version: 5.1.5
|
4
4
|
Summary: authentication layer for my personal server.
|
5
5
|
Home-page: https://github.com/thepmsquare/square_authentication
|
6
6
|
Author: thePmSquare
|
7
7
|
Author-email: thepmsquare@gmail.com
|
8
|
-
License: UNKNOWN
|
9
|
-
Platform: UNKNOWN
|
10
8
|
Classifier: Development Status :: 3 - Alpha
|
11
9
|
Classifier: Intended Audience :: Developers
|
12
10
|
Classifier: License :: OSI Approved :: MIT License
|
13
11
|
Classifier: Programming Language :: Python :: 3
|
14
12
|
Classifier: Programming Language :: Python :: 3.9
|
15
13
|
Description-Content-Type: text/markdown
|
14
|
+
Requires-Dist: uvicorn>=0.24.0.post1
|
15
|
+
Requires-Dist: fastapi>=0.104.1
|
16
|
+
Requires-Dist: pydantic>=2.5.3
|
17
|
+
Requires-Dist: bcrypt>=4.1.2
|
18
|
+
Requires-Dist: pyjwt>=2.8.0
|
19
|
+
Requires-Dist: requests>=2.32.3
|
20
|
+
Requires-Dist: cryptography>=42.0.7
|
21
|
+
Requires-Dist: square_commons>=1.0.0
|
22
|
+
Requires-Dist: square_logger>=2.0.0
|
23
|
+
Requires-Dist: square_database_helper>=2.0.0
|
24
|
+
Requires-Dist: square_database_structure>=2.3.1
|
25
|
+
Requires-Dist: pytest>=8.0.0
|
26
|
+
Requires-Dist: httpx>=0.27.2
|
27
|
+
Dynamic: author
|
28
|
+
Dynamic: author-email
|
29
|
+
Dynamic: classifier
|
30
|
+
Dynamic: description
|
31
|
+
Dynamic: description-content-type
|
32
|
+
Dynamic: home-page
|
33
|
+
Dynamic: requires-dist
|
34
|
+
Dynamic: summary
|
16
35
|
|
17
36
|
# square_authentication
|
18
37
|
|
@@ -32,6 +51,14 @@ pip install square_authentication
|
|
32
51
|
|
33
52
|
## changelog
|
34
53
|
|
54
|
+
### v5.1.5
|
55
|
+
|
56
|
+
- bump square_logger to >=2.0.0.
|
57
|
+
|
58
|
+
### v5.1.4
|
59
|
+
|
60
|
+
- re bug fix v5.1.3
|
61
|
+
|
35
62
|
### v5.1.3
|
36
63
|
|
37
64
|
- bugfix in login_username/v0 (getting creds from correct table).
|
@@ -135,5 +162,3 @@ pip install square_authentication
|
|
135
162
|
- initial implementation.
|
136
163
|
|
137
164
|
## Feedback is appreciated. Thank you!
|
138
|
-
|
139
|
-
|
@@ -4,7 +4,7 @@ package_name = "square_authentication"
|
|
4
4
|
|
5
5
|
setup(
|
6
6
|
name=package_name,
|
7
|
-
version="5.1.
|
7
|
+
version="5.1.5",
|
8
8
|
packages=find_packages(),
|
9
9
|
package_data={
|
10
10
|
package_name: ["data/*"],
|
@@ -18,7 +18,7 @@ setup(
|
|
18
18
|
"requests>=2.32.3",
|
19
19
|
"cryptography>=42.0.7",
|
20
20
|
"square_commons>=1.0.0",
|
21
|
-
"square_logger>=
|
21
|
+
"square_logger>=2.0.0",
|
22
22
|
"square_database_helper>=2.0.0",
|
23
23
|
"square_database_structure>=2.3.1",
|
24
24
|
"pytest>=8.0.0",
|
@@ -31,7 +31,7 @@ app.include_router(utility.router)
|
|
31
31
|
|
32
32
|
|
33
33
|
@app.get("/")
|
34
|
-
@global_object_square_logger.
|
34
|
+
@global_object_square_logger.auto_logger()
|
35
35
|
async def root():
|
36
36
|
output_content = get_api_output_in_standard_format(log=config_str_module_name)
|
37
37
|
return JSONResponse(status_code=status.HTTP_200_OK, content=output_content)
|
{square_authentication-5.1.3 → square_authentication-5.1.5}/square_authentication/routes/core.py
RENAMED
@@ -57,7 +57,7 @@ global_object_square_database_helper = SquareDatabaseHelper(
|
|
57
57
|
|
58
58
|
|
59
59
|
@router.post("/register_username/v0")
|
60
|
-
@global_object_square_logger.
|
60
|
+
@global_object_square_logger.auto_logger()
|
61
61
|
async def register_username_v0(
|
62
62
|
body: RegisterUsernameV0,
|
63
63
|
):
|
@@ -75,7 +75,7 @@ async def register_username_v0(
|
|
75
75
|
validation
|
76
76
|
"""
|
77
77
|
# validation for username
|
78
|
-
|
78
|
+
local_list_response_user_creds = (
|
79
79
|
global_object_square_database_helper.get_rows_v0(
|
80
80
|
database_name=global_string_database_name,
|
81
81
|
schema_name=global_string_schema_name,
|
@@ -89,20 +89,6 @@ async def register_username_v0(
|
|
89
89
|
),
|
90
90
|
)["data"]["main"]
|
91
91
|
)
|
92
|
-
local_list_response_user_creds = (
|
93
|
-
global_object_square_database_helper.get_rows_v0(
|
94
|
-
database_name=global_string_database_name,
|
95
|
-
schema_name=global_string_schema_name,
|
96
|
-
table_name=UserCredential.__tablename__,
|
97
|
-
filters=FiltersV0(
|
98
|
-
root={
|
99
|
-
UserCredential.user_id.name: FilterConditionsV0(
|
100
|
-
eq=local_list_response_user_profile[0][UserProfile.user_id.name]
|
101
|
-
)
|
102
|
-
}
|
103
|
-
),
|
104
|
-
)["data"]["main"]
|
105
|
-
)
|
106
92
|
if len(local_list_response_user_creds) > 0:
|
107
93
|
output_content = get_api_output_in_standard_format(
|
108
94
|
message=messages["USERNAME_ALREADY_EXISTS"],
|
@@ -260,7 +246,7 @@ async def register_username_v0(
|
|
260
246
|
|
261
247
|
|
262
248
|
@router.get("/get_user_details/v0")
|
263
|
-
@global_object_square_logger.
|
249
|
+
@global_object_square_logger.auto_logger()
|
264
250
|
async def get_user_details_v0(
|
265
251
|
access_token: Annotated[str, Header()],
|
266
252
|
):
|
@@ -388,7 +374,7 @@ async def get_user_details_v0(
|
|
388
374
|
|
389
375
|
|
390
376
|
@router.patch("/update_user_app_ids/v0")
|
391
|
-
@global_object_square_logger.
|
377
|
+
@global_object_square_logger.auto_logger()
|
392
378
|
async def update_user_app_ids_v0(
|
393
379
|
access_token: Annotated[str, Header()],
|
394
380
|
app_ids_to_add: List[int],
|
@@ -549,7 +535,7 @@ async def update_user_app_ids_v0(
|
|
549
535
|
|
550
536
|
|
551
537
|
@router.post("/login_username/v0")
|
552
|
-
@global_object_square_logger.
|
538
|
+
@global_object_square_logger.auto_logger()
|
553
539
|
async def login_username_v0(body: LoginUsernameV0):
|
554
540
|
username = body.username
|
555
541
|
password = body.password
|
@@ -561,7 +547,7 @@ async def login_username_v0(body: LoginUsernameV0):
|
|
561
547
|
validation
|
562
548
|
"""
|
563
549
|
# validation for username
|
564
|
-
|
550
|
+
local_list_response_user_profile = (
|
565
551
|
global_object_square_database_helper.get_rows_v0(
|
566
552
|
database_name=global_string_database_name,
|
567
553
|
schema_name=global_string_schema_name,
|
@@ -575,6 +561,31 @@ async def login_username_v0(body: LoginUsernameV0):
|
|
575
561
|
),
|
576
562
|
)["data"]["main"]
|
577
563
|
)
|
564
|
+
if len(local_list_response_user_profile) != 1:
|
565
|
+
output_content = get_api_output_in_standard_format(
|
566
|
+
message=messages["INCORRECT_USERNAME"],
|
567
|
+
log=f"incorrect username {username}",
|
568
|
+
)
|
569
|
+
raise HTTPException(
|
570
|
+
status_code=status.HTTP_400_BAD_REQUEST,
|
571
|
+
detail=output_content,
|
572
|
+
)
|
573
|
+
local_list_authentication_user_response = (
|
574
|
+
global_object_square_database_helper.get_rows_v0(
|
575
|
+
database_name=global_string_database_name,
|
576
|
+
schema_name=global_string_schema_name,
|
577
|
+
table_name=UserCredential.__tablename__,
|
578
|
+
filters=FiltersV0(
|
579
|
+
root={
|
580
|
+
UserCredential.user_id.name: FilterConditionsV0(
|
581
|
+
eq=local_list_response_user_profile[0][
|
582
|
+
UserProfile.user_id.name
|
583
|
+
]
|
584
|
+
)
|
585
|
+
}
|
586
|
+
),
|
587
|
+
)["data"]["main"]
|
588
|
+
)
|
578
589
|
if len(local_list_authentication_user_response) != 1:
|
579
590
|
output_content = get_api_output_in_standard_format(
|
580
591
|
message=messages["INCORRECT_USERNAME"],
|
@@ -733,7 +744,7 @@ async def login_username_v0(body: LoginUsernameV0):
|
|
733
744
|
|
734
745
|
|
735
746
|
@router.get("/generate_access_token/v0")
|
736
|
-
@global_object_square_logger.
|
747
|
+
@global_object_square_logger.auto_logger()
|
737
748
|
async def generate_access_token_v0(
|
738
749
|
refresh_token: Annotated[str, Header()],
|
739
750
|
):
|
@@ -824,7 +835,7 @@ async def generate_access_token_v0(
|
|
824
835
|
|
825
836
|
|
826
837
|
@router.delete("/logout/v0")
|
827
|
-
@global_object_square_logger.
|
838
|
+
@global_object_square_logger.auto_logger()
|
828
839
|
async def logout_v0(
|
829
840
|
refresh_token: Annotated[str, Header()],
|
830
841
|
):
|
@@ -916,7 +927,7 @@ async def logout_v0(
|
|
916
927
|
|
917
928
|
|
918
929
|
@router.delete("/logout/apps/v0")
|
919
|
-
@global_object_square_logger.
|
930
|
+
@global_object_square_logger.auto_logger()
|
920
931
|
async def logout_apps_v0(
|
921
932
|
access_token: Annotated[str, Header()],
|
922
933
|
body: LogoutAppsV0,
|
@@ -1009,7 +1020,7 @@ async def logout_apps_v0(
|
|
1009
1020
|
|
1010
1021
|
|
1011
1022
|
@router.delete("/logout/all/v0")
|
1012
|
-
@global_object_square_logger.
|
1023
|
+
@global_object_square_logger.auto_logger()
|
1013
1024
|
async def logout_all_v0(
|
1014
1025
|
access_token: Annotated[str, Header()],
|
1015
1026
|
):
|
@@ -1073,7 +1084,7 @@ async def logout_all_v0(
|
|
1073
1084
|
|
1074
1085
|
|
1075
1086
|
@router.patch("/update_username/v0")
|
1076
|
-
@global_object_square_logger.
|
1087
|
+
@global_object_square_logger.auto_logger()
|
1077
1088
|
async def update_username_v0(
|
1078
1089
|
new_username: str,
|
1079
1090
|
access_token: Annotated[str, Header()],
|
@@ -1188,7 +1199,7 @@ async def update_username_v0(
|
|
1188
1199
|
|
1189
1200
|
|
1190
1201
|
@router.delete("/delete_user/v0")
|
1191
|
-
@global_object_square_logger.
|
1202
|
+
@global_object_square_logger.auto_logger()
|
1192
1203
|
async def delete_user_v0(
|
1193
1204
|
body: DeleteUserV0,
|
1194
1205
|
access_token: Annotated[str, Header()],
|
@@ -1294,7 +1305,7 @@ async def delete_user_v0(
|
|
1294
1305
|
|
1295
1306
|
|
1296
1307
|
@router.patch("/update_password/v0")
|
1297
|
-
@global_object_square_logger.
|
1308
|
+
@global_object_square_logger.auto_logger()
|
1298
1309
|
async def update_password_v0(
|
1299
1310
|
body: UpdatePasswordV0,
|
1300
1311
|
access_token: Annotated[str, Header()],
|
@@ -1407,7 +1418,7 @@ async def update_password_v0(
|
|
1407
1418
|
|
1408
1419
|
|
1409
1420
|
@router.get("/validate_and_get_payload_from_token/v0")
|
1410
|
-
@global_object_square_logger.
|
1421
|
+
@global_object_square_logger.auto_logger()
|
1411
1422
|
async def validate_and_get_payload_from_token_v0(
|
1412
1423
|
token: Annotated[str, Header()],
|
1413
1424
|
token_type: TokenType = Query(...),
|
@@ -7,7 +7,7 @@ from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
|
|
7
7
|
from square_authentication.configuration import global_object_square_logger
|
8
8
|
|
9
9
|
|
10
|
-
@global_object_square_logger.auto_logger
|
10
|
+
@global_object_square_logger.auto_logger()
|
11
11
|
def encrypt(key, plaintext):
|
12
12
|
# Ensure the key length is 16, 24, or 32 bytes for AES
|
13
13
|
key = key.ljust(32)[:32].encode('utf-8')
|
@@ -31,7 +31,7 @@ def encrypt(key, plaintext):
|
|
31
31
|
|
32
32
|
return encoded_ciphertext
|
33
33
|
|
34
|
-
@global_object_square_logger.auto_logger
|
34
|
+
@global_object_square_logger.auto_logger()
|
35
35
|
def decrypt(key, encoded_ciphertext):
|
36
36
|
# Ensure the key length is 16, 24, or 32 bytes for AES
|
37
37
|
key = key.ljust(32)[:32].encode('utf-8')
|
{square_authentication-5.1.3 → square_authentication-5.1.5}/square_authentication/utils/token.py
RENAMED
@@ -4,7 +4,7 @@ from jwt.exceptions import ExpiredSignatureError, DecodeError, InvalidTokenError
|
|
4
4
|
from square_authentication.configuration import global_object_square_logger
|
5
5
|
|
6
6
|
|
7
|
-
@global_object_square_logger.auto_logger
|
7
|
+
@global_object_square_logger.auto_logger()
|
8
8
|
def get_jwt_payload(token, secret_key):
|
9
9
|
try:
|
10
10
|
# Decode the token and verify the signature
|
{square_authentication-5.1.3 → square_authentication-5.1.5}/square_authentication.egg-info/PKG-INFO
RENAMED
@@ -1,18 +1,37 @@
|
|
1
|
-
Metadata-Version: 2.
|
2
|
-
Name:
|
3
|
-
Version: 5.1.
|
1
|
+
Metadata-Version: 2.4
|
2
|
+
Name: square_authentication
|
3
|
+
Version: 5.1.5
|
4
4
|
Summary: authentication layer for my personal server.
|
5
5
|
Home-page: https://github.com/thepmsquare/square_authentication
|
6
6
|
Author: thePmSquare
|
7
7
|
Author-email: thepmsquare@gmail.com
|
8
|
-
License: UNKNOWN
|
9
|
-
Platform: UNKNOWN
|
10
8
|
Classifier: Development Status :: 3 - Alpha
|
11
9
|
Classifier: Intended Audience :: Developers
|
12
10
|
Classifier: License :: OSI Approved :: MIT License
|
13
11
|
Classifier: Programming Language :: Python :: 3
|
14
12
|
Classifier: Programming Language :: Python :: 3.9
|
15
13
|
Description-Content-Type: text/markdown
|
14
|
+
Requires-Dist: uvicorn>=0.24.0.post1
|
15
|
+
Requires-Dist: fastapi>=0.104.1
|
16
|
+
Requires-Dist: pydantic>=2.5.3
|
17
|
+
Requires-Dist: bcrypt>=4.1.2
|
18
|
+
Requires-Dist: pyjwt>=2.8.0
|
19
|
+
Requires-Dist: requests>=2.32.3
|
20
|
+
Requires-Dist: cryptography>=42.0.7
|
21
|
+
Requires-Dist: square_commons>=1.0.0
|
22
|
+
Requires-Dist: square_logger>=2.0.0
|
23
|
+
Requires-Dist: square_database_helper>=2.0.0
|
24
|
+
Requires-Dist: square_database_structure>=2.3.1
|
25
|
+
Requires-Dist: pytest>=8.0.0
|
26
|
+
Requires-Dist: httpx>=0.27.2
|
27
|
+
Dynamic: author
|
28
|
+
Dynamic: author-email
|
29
|
+
Dynamic: classifier
|
30
|
+
Dynamic: description
|
31
|
+
Dynamic: description-content-type
|
32
|
+
Dynamic: home-page
|
33
|
+
Dynamic: requires-dist
|
34
|
+
Dynamic: summary
|
16
35
|
|
17
36
|
# square_authentication
|
18
37
|
|
@@ -32,6 +51,14 @@ pip install square_authentication
|
|
32
51
|
|
33
52
|
## changelog
|
34
53
|
|
54
|
+
### v5.1.5
|
55
|
+
|
56
|
+
- bump square_logger to >=2.0.0.
|
57
|
+
|
58
|
+
### v5.1.4
|
59
|
+
|
60
|
+
- re bug fix v5.1.3
|
61
|
+
|
35
62
|
### v5.1.3
|
36
63
|
|
37
64
|
- bugfix in login_username/v0 (getting creds from correct table).
|
@@ -135,5 +162,3 @@ pip install square_authentication
|
|
135
162
|
- initial implementation.
|
136
163
|
|
137
164
|
## Feedback is appreciated. Thank you!
|
138
|
-
|
139
|
-
|
@@ -0,0 +1,17 @@
|
|
1
|
+
from fastapi.testclient import TestClient
|
2
|
+
from square_commons import get_api_output_in_standard_format
|
3
|
+
|
4
|
+
from square_authentication.configuration import config_str_module_name
|
5
|
+
from square_authentication.main import (
|
6
|
+
app,
|
7
|
+
)
|
8
|
+
|
9
|
+
client = TestClient(app)
|
10
|
+
|
11
|
+
|
12
|
+
def test_read_main():
|
13
|
+
response = client.get("/")
|
14
|
+
assert response.status_code == 200
|
15
|
+
assert response.json() == get_api_output_in_standard_format(
|
16
|
+
log=config_str_module_name
|
17
|
+
)
|
File without changes
|
{square_authentication-5.1.3 → square_authentication-5.1.5}/square_authentication/__init__.py
RENAMED
File without changes
|
{square_authentication-5.1.3 → square_authentication-5.1.5}/square_authentication/configuration.py
RENAMED
File without changes
|
{square_authentication-5.1.3 → square_authentication-5.1.5}/square_authentication/data/config.ini
RENAMED
File without changes
|
{square_authentication-5.1.3 → square_authentication-5.1.5}/square_authentication/messages.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
{square_authentication-5.1.3 → square_authentication-5.1.5}/square_authentication/routes/__init__.py
RENAMED
File without changes
|
{square_authentication-5.1.3 → square_authentication-5.1.5}/square_authentication/utils/__init__.py
RENAMED
File without changes
|
File without changes
|
File without changes
|