auth and token middleware context update

This commit is contained in:
2025-01-26 20:18:06 +03:00
parent 3d5a43220e
commit a7e48d8755
17 changed files with 265 additions and 345 deletions

View File

@@ -5,6 +5,7 @@ from ApiLayers.ApiLibrary.common.line_number import get_line_number_for_error
from ApiLayers.ApiServices.Login.user_login_handler import UserLoginModule
from ApiLayers.ApiServices.Token.token_handler import TokenService
from ApiLayers.ApiValidations.Custom.token_objects import CompanyToken, OccupantToken
from ApiLayers.ApiValidations.Custom.wrapper_contexts import AuthContext, EventContext
from ApiLayers.ErrorHandlers import HTTPExceptionApi
from ApiLayers.Schemas import (
BuildLivingSpace,
@@ -372,14 +373,12 @@ def authentication_logout_user(request: Request, data: Any):
# selected_user.remove_refresher_token(domain=data.domain)
# return ResponseHandler.success("Session is logged out", data=token_user)
# return ResponseHandler.not_found("Logout is not successfully completed")
token_dict = authentication_logout_user.auth
print('token_dict', token_dict)
func_code = authentication_logout_user.func_code
print('func_code', func_code)
return
event_context: EventContext = getattr(authentication_logout_user, "event_context", None)
return event_context.model_dump()
def authentication_refresher_token(request: Request, token_dict: TokenDictType, data: Any):
def authentication_refresher_token(request: Request, data: Any):
"""Refresh access token with refresher token"""
# token_refresher = UsersTokens.filter_by_one(
# token=data.refresh_token,
@@ -402,7 +401,8 @@ def authentication_refresher_token(request: Request, token_dict: TokenDictType,
# }
# return ResponseHandler.success("User is logged in successfully via refresher token", data=response_data)
# return ResponseHandler.not_found("Invalid data")
return
auth_context: AuthContext = getattr(authentication_refresher_token, "auth_context", None)
return auth_context.model_dump()
def authentication_forgot_password(request: Request, data: Any):