square-authentication 5.1.3__py3-none-any.whl → 5.1.5__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.
@@ -31,7 +31,7 @@ app.include_router(utility.router)
31
31
 
32
32
 
33
33
  @app.get("/")
34
- @global_object_square_logger.async_auto_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)
@@ -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.async_auto_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
- local_list_response_user_profile = (
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.async_auto_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.async_auto_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.async_auto_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
- local_list_authentication_user_response = (
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.async_auto_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.async_auto_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.async_auto_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.async_auto_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.async_auto_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.async_auto_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.async_auto_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.async_auto_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(...),
@@ -12,7 +12,7 @@ router = APIRouter(
12
12
 
13
13
 
14
14
  @router.get("/get_text_hash/v0")
15
- @global_object_square_logger.async_auto_logger
15
+ @global_object_square_logger.auto_logger()
16
16
  async def get_text_hash_v0(plain_text: str):
17
17
 
18
18
  try:
@@ -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')
@@ -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
@@ -1,12 +1,10 @@
1
- Metadata-Version: 2.1
2
- Name: square-authentication
3
- Version: 5.1.3
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
@@ -20,12 +18,20 @@ Requires-Dist: bcrypt>=4.1.2
20
18
  Requires-Dist: pyjwt>=2.8.0
21
19
  Requires-Dist: requests>=2.32.3
22
20
  Requires-Dist: cryptography>=42.0.7
23
- Requires-Dist: square-commons>=1.0.0
24
- Requires-Dist: square-logger>=1.0.0
25
- Requires-Dist: square-database-helper>=2.0.0
26
- Requires-Dist: square-database-structure>=2.3.1
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
27
25
  Requires-Dist: pytest>=8.0.0
28
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
29
35
 
30
36
  # square_authentication
31
37
 
@@ -45,6 +51,14 @@ pip install square_authentication
45
51
 
46
52
  ## changelog
47
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
+
48
62
  ### v5.1.3
49
63
 
50
64
  - bugfix in login_username/v0 (getting creds from correct table).
@@ -148,5 +162,3 @@ pip install square_authentication
148
162
  - initial implementation.
149
163
 
150
164
  ## Feedback is appreciated. Thank you!
151
-
152
-
@@ -1,17 +1,17 @@
1
1
  square_authentication/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  square_authentication/configuration.py,sha256=i0uNtNSQd-n1rBxFM6jsIz1Wy3d090RcdTViSqHKc7Y,2973
3
- square_authentication/main.py,sha256=95YgTBOuh2paWg3W0g0CvrQCeyTr0Q89fL14GmUxv2g,1664
3
+ square_authentication/main.py,sha256=zP8Affuljk1m7fsRSa1WG8KP0xdcVgOvA-62bWlLe4s,1660
4
4
  square_authentication/messages.py,sha256=BA9KC0vW9UD1ZXT4VneVqVNLlgdbMdsAwAgxhJISLf4,1175
5
5
  square_authentication/data/config.ini,sha256=_740RvKpL5W2bUDGwZ7ePwuP-mAasr5cXXB81yq_Jv8,906
6
6
  square_authentication/pydantic_models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
7
  square_authentication/pydantic_models/core.py,sha256=qeNETcJv7mnRKGhATOW2bg0NlHuyzvot1dZ1b1qqhwU,610
8
8
  square_authentication/routes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
- square_authentication/routes/core.py,sha256=AM_OiqSndZ6-4c28QnEICXx6WZOms9UzHUYk3wBv5ZA,56795
10
- square_authentication/routes/utility.py,sha256=ocLWj39JbKVOxgyTsM0xBUgTpHFmKIvvaT3UnjFvuOY,1783
9
+ square_authentication/routes/core.py,sha256=nfATWJ3NWQkCe9gmMhJIh1lsdxmiCQ1OL3HoqIhFd88,57195
10
+ square_authentication/routes/utility.py,sha256=KDr8KdkT0jAGPjfP-b5XXYG7p49WU7J1FiK6oSIckQI,1779
11
11
  square_authentication/utils/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
12
- square_authentication/utils/encryption.py,sha256=amlTNbGvq59eFLX6pq084UDLI3deM-urLjb4fOYIeNw,2023
13
- square_authentication/utils/token.py,sha256=2psHT6CGqQLmkhsPHVYS8_2jEjN96J9gLAM4lB_fa88,678
14
- square_authentication-5.1.3.dist-info/METADATA,sha256=9W4cTp_4-DIGzWMg4j0601MaeYHCw97gsURKgHG5U0I,4044
15
- square_authentication-5.1.3.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
16
- square_authentication-5.1.3.dist-info/top_level.txt,sha256=wDssVJIl9KIEJPj5rR3rv4uRI7yCndMBrvHd_6BGXQA,22
17
- square_authentication-5.1.3.dist-info/RECORD,,
12
+ square_authentication/utils/encryption.py,sha256=WakaiEAgWpTJltxBzqOtv81_DCDKfzJqt60fWSPoNvo,2027
13
+ square_authentication/utils/token.py,sha256=t-RPBY4cYyT1ro3lkLBTOy2BeRGBfluBVBivL5DLmDg,680
14
+ square_authentication-5.1.5.dist-info/METADATA,sha256=0GDaWp1LZIJ1WGH1_r-uf0GhBgfuERwosV8hzZ8wl0s,4258
15
+ square_authentication-5.1.5.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
16
+ square_authentication-5.1.5.dist-info/top_level.txt,sha256=wDssVJIl9KIEJPj5rR3rv4uRI7yCndMBrvHd_6BGXQA,22
17
+ square_authentication-5.1.5.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.45.1)
2
+ Generator: setuptools (78.1.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5