auth updated routes tested & password is not yet tested
This commit is contained in:
@@ -13,11 +13,10 @@ from ApiLayers.ApiValidations.Custom.token_objects import (
|
||||
OccupantTokenObject,
|
||||
)
|
||||
from ApiLayers.ApiValidations.Custom.wrapper_contexts import AuthContext, EventContext
|
||||
from ApiLayers.AllConfigs.Token.config import Auth
|
||||
|
||||
|
||||
TokenDictType = Union[
|
||||
EmployeeTokenObject, OccupantTokenObject
|
||||
] # Type aliases for common types
|
||||
TokenDictType = Union[EmployeeTokenObject, OccupantTokenObject]
|
||||
|
||||
|
||||
class EndpointBaseRequestModel(BaseModel):
|
||||
@@ -81,3 +80,13 @@ class ContextRetrievers:
|
||||
def base(self) -> Optional[dict[str, Any]]:
|
||||
"""Retrieve base request model from a function."""
|
||||
return getattr(self.context, "base", None)
|
||||
|
||||
@property
|
||||
def get_token(self) -> Optional[str]:
|
||||
"""Retrieve access key from a function."""
|
||||
return getattr(self.request, "headers", {}).get(Auth.ACCESS_TOKEN_TAG, None)
|
||||
|
||||
|
||||
class BaseRouteModel:
|
||||
|
||||
context_retriever: Union[ContextRetrievers] = None
|
||||
|
||||
Reference in New Issue
Block a user