square-authentication 4.2.0__tar.gz → 4.2.1__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.
Files changed (22) hide show
  1. {square_authentication-4.2.0 → square_authentication-4.2.1}/PKG-INFO +6 -1
  2. {square_authentication-4.2.0 → square_authentication-4.2.1}/README.md +5 -0
  3. {square_authentication-4.2.0 → square_authentication-4.2.1}/setup.py +1 -1
  4. {square_authentication-4.2.0 → square_authentication-4.2.1}/square_authentication/routes/core.py +31 -1
  5. {square_authentication-4.2.0 → square_authentication-4.2.1}/square_authentication.egg-info/PKG-INFO +6 -1
  6. {square_authentication-4.2.0 → square_authentication-4.2.1}/setup.cfg +0 -0
  7. {square_authentication-4.2.0 → square_authentication-4.2.1}/square_authentication/__init__.py +0 -0
  8. {square_authentication-4.2.0 → square_authentication-4.2.1}/square_authentication/configuration.py +0 -0
  9. {square_authentication-4.2.0 → square_authentication-4.2.1}/square_authentication/data/config.ini +0 -0
  10. {square_authentication-4.2.0 → square_authentication-4.2.1}/square_authentication/main.py +0 -0
  11. {square_authentication-4.2.0 → square_authentication-4.2.1}/square_authentication/messages.py +0 -0
  12. {square_authentication-4.2.0 → square_authentication-4.2.1}/square_authentication/pydantic_models/__init__.py +0 -0
  13. {square_authentication-4.2.0 → square_authentication-4.2.1}/square_authentication/pydantic_models/core.py +0 -0
  14. {square_authentication-4.2.0 → square_authentication-4.2.1}/square_authentication/routes/__init__.py +0 -0
  15. {square_authentication-4.2.0 → square_authentication-4.2.1}/square_authentication/routes/utility.py +0 -0
  16. {square_authentication-4.2.0 → square_authentication-4.2.1}/square_authentication/utils/__init__.py +0 -0
  17. {square_authentication-4.2.0 → square_authentication-4.2.1}/square_authentication/utils/encryption.py +0 -0
  18. {square_authentication-4.2.0 → square_authentication-4.2.1}/square_authentication/utils/token.py +0 -0
  19. {square_authentication-4.2.0 → square_authentication-4.2.1}/square_authentication.egg-info/SOURCES.txt +0 -0
  20. {square_authentication-4.2.0 → square_authentication-4.2.1}/square_authentication.egg-info/dependency_links.txt +0 -0
  21. {square_authentication-4.2.0 → square_authentication-4.2.1}/square_authentication.egg-info/requires.txt +0 -0
  22. {square_authentication-4.2.0 → square_authentication-4.2.1}/square_authentication.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: square_authentication
3
- Version: 4.2.0
3
+ Version: 4.2.1
4
4
  Summary: authentication layer for my personal server.
5
5
  Home-page: https://github.com/thepmsquare/square_authentication
6
6
  Author: thePmSquare
@@ -32,6 +32,11 @@ pip install square_authentication
32
32
 
33
33
  ## changelog
34
34
 
35
+ ### v4.2.1
36
+
37
+ - fix output format in validate_and_get_payload_from_token/v0.
38
+ - add db check refresh token validation in validate_and_get_payload_from_token/v0.
39
+
35
40
  ### v4.2.0
36
41
 
37
42
  - add validate_and_get_payload_from_token/v0 in core.
@@ -16,6 +16,11 @@ pip install square_authentication
16
16
 
17
17
  ## changelog
18
18
 
19
+ ### v4.2.1
20
+
21
+ - fix output format in validate_and_get_payload_from_token/v0.
22
+ - add db check refresh token validation in validate_and_get_payload_from_token/v0.
23
+
19
24
  ### v4.2.0
20
25
 
21
26
  - add validate_and_get_payload_from_token/v0 in core.
@@ -4,7 +4,7 @@ package_name = "square_authentication"
4
4
 
5
5
  setup(
6
6
  name=package_name,
7
- version="4.2.0",
7
+ version="4.2.1",
8
8
  packages=find_packages(),
9
9
  package_data={
10
10
  package_name: ["data/*"],
@@ -1226,6 +1226,35 @@ async def validate_and_get_payload_from_token_v0(
1226
1226
  local_dict_token_payload = get_jwt_payload(
1227
1227
  token, config_str_secret_key_for_refresh_token
1228
1228
  )
1229
+ local_list_response_user_session = global_object_square_database_helper.get_rows_v0(
1230
+ database_name=global_string_database_name,
1231
+ schema_name=global_string_schema_name,
1232
+ table_name=UserSession.__tablename__,
1233
+ filters=FiltersV0(
1234
+ root={
1235
+ UserSession.user_session_refresh_token.name: FilterConditionsV0(
1236
+ eq=token
1237
+ ),
1238
+ UserSession.user_id.name: FilterConditionsV0(
1239
+ eq=local_dict_token_payload["user_id"]
1240
+ ),
1241
+ }
1242
+ ),
1243
+ )[
1244
+ "data"
1245
+ ][
1246
+ "main"
1247
+ ]
1248
+ if len(local_list_response_user_session) != 1:
1249
+ output_content = get_api_output_in_standard_format(
1250
+ message=messages["INCORRECT_REFRESH_TOKEN"],
1251
+ log="refresh token valid but not present in database.",
1252
+ )
1253
+ return JSONResponse(
1254
+ status_code=status.HTTP_400_BAD_REQUEST,
1255
+ content=output_content,
1256
+ )
1257
+
1229
1258
  except Exception as error:
1230
1259
  output_content = None
1231
1260
  if token_type == TokenType.access_token:
@@ -1250,7 +1279,8 @@ async def validate_and_get_payload_from_token_v0(
1250
1279
  return value
1251
1280
  """
1252
1281
  output_content = get_api_output_in_standard_format(
1253
- message=messages["GENERIC_READ_SUCCESSFUL"], data=local_dict_token_payload
1282
+ message=messages["GENERIC_READ_SUCCESSFUL"],
1283
+ data={"main": local_dict_token_payload},
1254
1284
  )
1255
1285
  return JSONResponse(status_code=status.HTTP_200_OK, content=output_content)
1256
1286
  except HTTPException as http_exception:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: square-authentication
3
- Version: 4.2.0
3
+ Version: 4.2.1
4
4
  Summary: authentication layer for my personal server.
5
5
  Home-page: https://github.com/thepmsquare/square_authentication
6
6
  Author: thePmSquare
@@ -32,6 +32,11 @@ pip install square_authentication
32
32
 
33
33
  ## changelog
34
34
 
35
+ ### v4.2.1
36
+
37
+ - fix output format in validate_and_get_payload_from_token/v0.
38
+ - add db check refresh token validation in validate_and_get_payload_from_token/v0.
39
+
35
40
  ### v4.2.0
36
41
 
37
42
  - add validate_and_get_payload_from_token/v0 in core.