square-authentication 4.2.0__py3-none-any.whl → 4.3.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.
@@ -20,6 +20,7 @@ app = FastAPI()
20
20
 
21
21
  app.add_middleware(
22
22
  CORSMiddleware,
23
+ allow_credentials=True,
23
24
  allow_origins=["*"],
24
25
  allow_methods=["*"],
25
26
  allow_headers=["*"],
@@ -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.3.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,15 @@ pip install square_authentication
43
43
 
44
44
  ## changelog
45
45
 
46
+ ### v4.3.0
47
+
48
+ - set allow_credentials=True.
49
+
50
+ ### v4.2.1
51
+
52
+ - fix output format in validate_and_get_payload_from_token/v0.
53
+ - add db check refresh token validation in validate_and_get_payload_from_token/v0.
54
+
46
55
  ### v4.2.0
47
56
 
48
57
  - add validate_and_get_payload_from_token/v0 in core.
@@ -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=JK9KBmN73KL8EpKrXrjrwwf37bmC4AXrFHtfl2roYwQ,1636
3
+ square_authentication/main.py,sha256=95YgTBOuh2paWg3W0g0CvrQCeyTr0Q89fL14GmUxv2g,1664
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=D4Q76oBl9wTDe7DMq96Bryk6a0GpuZStoU4w_KXkAd0,548
8
8
  square_authentication/routes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
- square_authentication/routes/core.py,sha256=oc0zwDvE6RcmYkHrbhshBjfW-ZgvPH2kefPnTpyqtEY,47128
9
+ square_authentication/routes/core.py,sha256=-ItaSNQqz_M5H8OdOaMuivyxg2g5eVsnpzq-v0tXSFo,48485
10
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.2.0.dist-info/METADATA,sha256=982awnaEnVbeW8IBByfAgGOJ9EthybCmT6ikElJVZSA,2971
15
- square_authentication-4.2.0.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
16
- square_authentication-4.2.0.dist-info/top_level.txt,sha256=wDssVJIl9KIEJPj5rR3rv4uRI7yCndMBrvHd_6BGXQA,22
17
- square_authentication-4.2.0.dist-info/RECORD,,
14
+ square_authentication-4.3.0.dist-info/METADATA,sha256=Tot-MLnHHu3mUgkyapkne6Wxx3JXQrWJ3WBUg3AcAwE,3173
15
+ square_authentication-4.3.0.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
16
+ square_authentication-4.3.0.dist-info/top_level.txt,sha256=wDssVJIl9KIEJPj5rR3rv4uRI7yCndMBrvHd_6BGXQA,22
17
+ square_authentication-4.3.0.dist-info/RECORD,,