maleo-foundation 0.3.72__py3-none-any.whl → 0.3.74__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.
- maleo_foundation/authentication.py +2 -48
- maleo_foundation/constants.py +2 -0
- maleo_foundation/enums.py +7 -1
- maleo_foundation/managers/middleware.py +8 -8
- maleo_foundation/managers/service.py +8 -4
- maleo_foundation/middlewares/authentication.py +3 -2
- maleo_foundation/middlewares/base.py +312 -197
- maleo_foundation/models/schemas/general.py +1 -127
- maleo_foundation/models/transfers/general/authentication.py +35 -0
- maleo_foundation/{authorization.py → models/transfers/general/authorization.py} +0 -3
- maleo_foundation/models/transfers/general/configurations/__init__.py +2 -0
- maleo_foundation/models/transfers/general/configurations/middleware.py +6 -7
- maleo_foundation/models/transfers/general/operation.py +192 -30
- maleo_foundation/models/transfers/general/request.py +13 -19
- maleo_foundation/models/transfers/general/response.py +14 -0
- maleo_foundation/models/transfers/general/service.py +9 -0
- maleo_foundation/models/transfers/general/user_agent.py +34 -0
- maleo_foundation/utils/exceptions/client.py +22 -23
- maleo_foundation/utils/exceptions/service.py +21 -22
- maleo_foundation/utils/extractor.py +49 -19
- maleo_foundation/utils/logging.py +40 -0
- maleo_foundation/utils/parser.py +7 -0
- {maleo_foundation-0.3.72.dist-info → maleo_foundation-0.3.74.dist-info}/METADATA +3 -1
- {maleo_foundation-0.3.72.dist-info → maleo_foundation-0.3.74.dist-info}/RECORD +26 -24
- maleo_foundation/utils/dependencies/__init__.py +0 -6
- maleo_foundation/utils/dependencies/auth.py +0 -17
- maleo_foundation/utils/dependencies/context.py +0 -8
- {maleo_foundation-0.3.72.dist-info → maleo_foundation-0.3.74.dist-info}/WHEEL +0 -0
- {maleo_foundation-0.3.72.dist-info → maleo_foundation-0.3.74.dist-info}/top_level.txt +0 -0
@@ -3,11 +3,12 @@ from functools import wraps
|
|
3
3
|
from httpx import RequestError
|
4
4
|
from pydantic import ValidationError
|
5
5
|
from typing import Optional
|
6
|
+
from uuid import UUID
|
6
7
|
from maleo_foundation.enums import BaseEnums
|
7
|
-
from maleo_foundation.models.transfers.general.request import RequestContext
|
8
8
|
from maleo_foundation.models.transfers.results.client.service import (
|
9
9
|
BaseClientServiceResultsTransfers,
|
10
10
|
)
|
11
|
+
from maleo_foundation.types import BaseTypes
|
11
12
|
from maleo_foundation.utils.logging import BaseLogger
|
12
13
|
|
13
14
|
|
@@ -31,14 +32,12 @@ class BaseClientExceptions:
|
|
31
32
|
fail_result_class: type[
|
32
33
|
BaseClientServiceResultsTransfers.Fail
|
33
34
|
] = BaseClientServiceResultsTransfers.Fail,
|
34
|
-
|
35
|
+
operation_id: BaseTypes.OptionalUUID = None,
|
35
36
|
) -> BaseClientServiceResultsTransfers.Fail:
|
36
|
-
if logger:
|
37
|
+
if logger is not None:
|
37
38
|
log_string = f"{category} occurred while {summary}: '{str(e)}'"
|
38
|
-
if
|
39
|
-
log_string =
|
40
|
-
f"Request | ID: {request_context.request_id} - {log_string}"
|
41
|
-
)
|
39
|
+
if operation_id is not None:
|
40
|
+
log_string = f"{operation_id} - {log_string}"
|
42
41
|
logger.error(
|
43
42
|
log_string,
|
44
43
|
exc_info=True,
|
@@ -84,11 +83,11 @@ class BaseClientExceptions:
|
|
84
83
|
def decorator(func):
|
85
84
|
@wraps(func)
|
86
85
|
async def wrapper(*args, **kwargs):
|
87
|
-
# Search for
|
88
|
-
|
89
|
-
for
|
90
|
-
if
|
91
|
-
|
86
|
+
# Search for operation_id in args and kwargs
|
87
|
+
operation_id: BaseTypes.OptionalUUID = None
|
88
|
+
for k, v in kwargs.items():
|
89
|
+
if k == "operation_id":
|
90
|
+
operation_id = UUID(v)
|
92
91
|
break
|
93
92
|
try:
|
94
93
|
return await func(*args, **kwargs)
|
@@ -109,7 +108,7 @@ class BaseClientExceptions:
|
|
109
108
|
status_update_type=status_update_type,
|
110
109
|
logger=logger,
|
111
110
|
fail_result_class=fail_result_class,
|
112
|
-
|
111
|
+
operation_id=operation_id,
|
113
112
|
)
|
114
113
|
except RequestError as e:
|
115
114
|
return BaseClientExceptions._exception_handler(
|
@@ -128,7 +127,7 @@ class BaseClientExceptions:
|
|
128
127
|
status_update_type=status_update_type,
|
129
128
|
logger=logger,
|
130
129
|
fail_result_class=fail_result_class,
|
131
|
-
|
130
|
+
operation_id=operation_id,
|
132
131
|
)
|
133
132
|
except Exception as e:
|
134
133
|
return BaseClientExceptions._exception_handler(
|
@@ -147,7 +146,7 @@ class BaseClientExceptions:
|
|
147
146
|
status_update_type=status_update_type,
|
148
147
|
logger=logger,
|
149
148
|
fail_result_class=fail_result_class,
|
150
|
-
|
149
|
+
operation_id=operation_id,
|
151
150
|
)
|
152
151
|
|
153
152
|
return wrapper
|
@@ -175,11 +174,11 @@ class BaseClientExceptions:
|
|
175
174
|
def decorator(func):
|
176
175
|
@wraps(func)
|
177
176
|
def wrapper(*args, **kwargs):
|
178
|
-
# Search for
|
179
|
-
|
180
|
-
for
|
181
|
-
if
|
182
|
-
|
177
|
+
# Search for operation_id in args and kwargs
|
178
|
+
operation_id: BaseTypes.OptionalUUID = None
|
179
|
+
for k, v in kwargs.items():
|
180
|
+
if k == "operation_id":
|
181
|
+
operation_id = UUID(v)
|
183
182
|
break
|
184
183
|
try:
|
185
184
|
return func(*args, **kwargs)
|
@@ -200,7 +199,7 @@ class BaseClientExceptions:
|
|
200
199
|
status_update_type=status_update_type,
|
201
200
|
logger=logger,
|
202
201
|
fail_result_class=fail_result_class,
|
203
|
-
|
202
|
+
operation_id=operation_id,
|
204
203
|
)
|
205
204
|
except RequestError as e:
|
206
205
|
return BaseClientExceptions._exception_handler(
|
@@ -219,7 +218,7 @@ class BaseClientExceptions:
|
|
219
218
|
status_update_type=status_update_type,
|
220
219
|
logger=logger,
|
221
220
|
fail_result_class=fail_result_class,
|
222
|
-
|
221
|
+
operation_id=operation_id,
|
223
222
|
)
|
224
223
|
except Exception as e:
|
225
224
|
return BaseClientExceptions._exception_handler(
|
@@ -238,7 +237,7 @@ class BaseClientExceptions:
|
|
238
237
|
status_update_type=status_update_type,
|
239
238
|
logger=logger,
|
240
239
|
fail_result_class=fail_result_class,
|
241
|
-
|
240
|
+
operation_id=operation_id,
|
242
241
|
)
|
243
242
|
|
244
243
|
return wrapper
|
@@ -3,11 +3,12 @@ from functools import wraps
|
|
3
3
|
from pydantic import ValidationError
|
4
4
|
from sqlalchemy.exc import SQLAlchemyError
|
5
5
|
from typing import Optional
|
6
|
+
from uuid import UUID
|
6
7
|
from maleo_foundation.enums import BaseEnums
|
7
|
-
from maleo_foundation.models.transfers.general.request import RequestContext
|
8
8
|
from maleo_foundation.models.transfers.results.service.general import (
|
9
9
|
BaseServiceGeneralResultsTransfers,
|
10
10
|
)
|
11
|
+
from maleo_foundation.types import BaseTypes
|
11
12
|
from maleo_foundation.utils.logging import BaseLogger
|
12
13
|
|
13
14
|
|
@@ -31,14 +32,12 @@ class BaseServiceExceptions:
|
|
31
32
|
fail_result_class: type[
|
32
33
|
BaseServiceGeneralResultsTransfers.Fail
|
33
34
|
] = BaseServiceGeneralResultsTransfers.Fail,
|
34
|
-
|
35
|
+
operation_id: BaseTypes.OptionalUUID = None,
|
35
36
|
) -> BaseServiceGeneralResultsTransfers.Fail:
|
36
37
|
if logger is not None:
|
37
38
|
log_string = f"{category} occurred while {summary}: '{str(e)}'"
|
38
|
-
if
|
39
|
-
log_string =
|
40
|
-
f"Request | ID: {request_context.request_id} - {log_string}"
|
41
|
-
)
|
39
|
+
if operation_id is not None:
|
40
|
+
log_string = f"{operation_id} - {log_string}"
|
42
41
|
logger.error(
|
43
42
|
log_string,
|
44
43
|
exc_info=True,
|
@@ -84,11 +83,11 @@ class BaseServiceExceptions:
|
|
84
83
|
def decorator(func):
|
85
84
|
@wraps(func)
|
86
85
|
async def wrapper(*args, **kwargs):
|
87
|
-
# Search for
|
88
|
-
|
89
|
-
for
|
90
|
-
if
|
91
|
-
|
86
|
+
# Search for operation_id in args and kwargs
|
87
|
+
operation_id: BaseTypes.OptionalUUID = None
|
88
|
+
for k, v in kwargs.items():
|
89
|
+
if k == "operation_id":
|
90
|
+
operation_id = UUID(v)
|
92
91
|
break
|
93
92
|
try:
|
94
93
|
return await func(*args, **kwargs)
|
@@ -109,7 +108,7 @@ class BaseServiceExceptions:
|
|
109
108
|
status_update_type=status_update_type,
|
110
109
|
logger=logger,
|
111
110
|
fail_result_class=fail_result_class,
|
112
|
-
|
111
|
+
operation_id=operation_id,
|
113
112
|
)
|
114
113
|
except SQLAlchemyError as e:
|
115
114
|
return BaseServiceExceptions._exception_handler(
|
@@ -128,7 +127,7 @@ class BaseServiceExceptions:
|
|
128
127
|
status_update_type=status_update_type,
|
129
128
|
logger=logger,
|
130
129
|
fail_result_class=fail_result_class,
|
131
|
-
|
130
|
+
operation_id=operation_id,
|
132
131
|
)
|
133
132
|
except Exception as e:
|
134
133
|
return BaseServiceExceptions._exception_handler(
|
@@ -147,7 +146,7 @@ class BaseServiceExceptions:
|
|
147
146
|
status_update_type=status_update_type,
|
148
147
|
logger=logger,
|
149
148
|
fail_result_class=fail_result_class,
|
150
|
-
|
149
|
+
operation_id=operation_id,
|
151
150
|
)
|
152
151
|
|
153
152
|
return wrapper
|
@@ -175,11 +174,11 @@ class BaseServiceExceptions:
|
|
175
174
|
def decorator(func):
|
176
175
|
@wraps(func)
|
177
176
|
def wrapper(*args, **kwargs):
|
178
|
-
# Search for
|
179
|
-
|
180
|
-
for
|
181
|
-
if
|
182
|
-
|
177
|
+
# Search for operation_id in args and kwargs
|
178
|
+
operation_id: BaseTypes.OptionalUUID = None
|
179
|
+
for k, v in kwargs.items():
|
180
|
+
if k == "operation_id":
|
181
|
+
operation_id = UUID(v)
|
183
182
|
break
|
184
183
|
try:
|
185
184
|
return func(*args, **kwargs)
|
@@ -200,7 +199,7 @@ class BaseServiceExceptions:
|
|
200
199
|
status_update_type=status_update_type,
|
201
200
|
logger=logger,
|
202
201
|
fail_result_class=fail_result_class,
|
203
|
-
|
202
|
+
operation_id=operation_id,
|
204
203
|
)
|
205
204
|
except SQLAlchemyError as e:
|
206
205
|
return BaseServiceExceptions._exception_handler(
|
@@ -219,7 +218,7 @@ class BaseServiceExceptions:
|
|
219
218
|
status_update_type=status_update_type,
|
220
219
|
logger=logger,
|
221
220
|
fail_result_class=fail_result_class,
|
222
|
-
|
221
|
+
operation_id=operation_id,
|
223
222
|
)
|
224
223
|
except Exception as e:
|
225
224
|
return BaseServiceExceptions._exception_handler(
|
@@ -238,7 +237,7 @@ class BaseServiceExceptions:
|
|
238
237
|
status_update_type=status_update_type,
|
239
238
|
logger=logger,
|
240
239
|
fail_result_class=fail_result_class,
|
241
|
-
|
240
|
+
operation_id=operation_id,
|
242
241
|
)
|
243
242
|
|
244
243
|
return wrapper
|
@@ -1,8 +1,40 @@
|
|
1
|
-
from
|
2
|
-
from fastapi import
|
1
|
+
from fastapi import Request, Security
|
2
|
+
from fastapi.security import HTTPAuthorizationCredentials
|
3
3
|
from starlette.requests import HTTPConnection
|
4
|
-
from uuid import UUID
|
4
|
+
from uuid import UUID
|
5
|
+
from maleo_foundation.constants import TOKEN_SCHEME
|
6
|
+
from maleo_foundation.authentication import (
|
7
|
+
Credentials as RequestCredentials,
|
8
|
+
User as RequestUser,
|
9
|
+
)
|
10
|
+
from maleo_foundation.models.transfers.general.authentication import (
|
11
|
+
Authentication,
|
12
|
+
Credentials,
|
13
|
+
User,
|
14
|
+
)
|
15
|
+
from maleo_foundation.models.transfers.general.authorization import Authorization
|
5
16
|
from maleo_foundation.models.transfers.general.request import RequestContext
|
17
|
+
from .parser import parse_user_agent
|
18
|
+
|
19
|
+
|
20
|
+
def extract_authentication(request: Request) -> Authentication:
|
21
|
+
# validate credentials
|
22
|
+
request_credentials = request.auth
|
23
|
+
if not isinstance(request_credentials, RequestCredentials):
|
24
|
+
raise TypeError("'credentials' is not of type 'RequestCredentials'")
|
25
|
+
credentials = Credentials.model_validate(request_credentials, from_attributes=True)
|
26
|
+
# validate user
|
27
|
+
request_user = request.user
|
28
|
+
if not isinstance(request_user, RequestUser):
|
29
|
+
raise TypeError("'user' is not of type 'RequestUser'")
|
30
|
+
user = User.model_validate(request_user, from_attributes=True)
|
31
|
+
return Authentication(credentials=credentials, user=user)
|
32
|
+
|
33
|
+
|
34
|
+
def extract_authorization(
|
35
|
+
token: HTTPAuthorizationCredentials = Security(TOKEN_SCHEME),
|
36
|
+
) -> Authorization:
|
37
|
+
return Authorization(scheme=token.scheme, credentials=token.credentials)
|
6
38
|
|
7
39
|
|
8
40
|
def extract_client_ip(conn: HTTPConnection) -> str:
|
@@ -23,28 +55,26 @@ def extract_client_ip(conn: HTTPConnection) -> str:
|
|
23
55
|
return conn.client.host if conn.client else "unknown"
|
24
56
|
|
25
57
|
|
58
|
+
def extract_operation_id(request: Request) -> UUID:
|
59
|
+
return request.state.operation_id
|
60
|
+
|
61
|
+
|
26
62
|
def extract_request_context(request: Request) -> RequestContext:
|
27
|
-
|
63
|
+
request_id = request.state.request_id
|
64
|
+
requested_at = request.state.requested_at
|
28
65
|
|
29
|
-
|
30
|
-
if request_id is None:
|
31
|
-
request_id = uuid4()
|
32
|
-
else:
|
33
|
-
request_id = UUID(request_id)
|
66
|
+
headers = request.headers
|
34
67
|
|
35
68
|
ip_address = extract_client_ip(request)
|
36
69
|
|
37
|
-
|
38
|
-
|
39
|
-
ua_browser = ua_browser.replace('"', "").split(",")[0].strip()
|
70
|
+
user_agent_string = headers.get("user-agent", "")
|
71
|
+
user_agent = parse_user_agent(user_agent_string=user_agent_string)
|
40
72
|
|
41
73
|
return RequestContext(
|
42
74
|
request_id=request_id,
|
43
|
-
requested_at=
|
75
|
+
requested_at=requested_at,
|
44
76
|
method=request.method,
|
45
77
|
url=request.url.path,
|
46
|
-
path_params=None if not request.path_params else request.path_params,
|
47
|
-
query_params=None if not request.query_params else str(request.query_params),
|
48
78
|
ip_address=ip_address,
|
49
79
|
is_internal=(
|
50
80
|
None
|
@@ -55,10 +85,10 @@ def extract_request_context(request: Request) -> RequestContext:
|
|
55
85
|
or ip_address.startswith("172.")
|
56
86
|
)
|
57
87
|
),
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
88
|
+
headers=headers.items(),
|
89
|
+
path_params=None if not request.path_params else request.path_params,
|
90
|
+
query_params=None if not request.query_params else str(request.query_params),
|
91
|
+
user_agent=user_agent,
|
62
92
|
referer=headers.get("referer"),
|
63
93
|
origin=headers.get("origin"),
|
64
94
|
host=headers.get("host"),
|
@@ -236,6 +236,26 @@ class ClientLogger(BaseLogger):
|
|
236
236
|
)
|
237
237
|
|
238
238
|
|
239
|
+
class ControllerLogger(BaseLogger):
|
240
|
+
def __init__(
|
241
|
+
self,
|
242
|
+
dir: str,
|
243
|
+
environment: Optional[BaseEnums.EnvironmentType] = None,
|
244
|
+
service_key: Optional[BaseEnums.Service] = None,
|
245
|
+
level: BaseEnums.LoggerLevel = BaseEnums.LoggerLevel.INFO,
|
246
|
+
google_cloud_logging: Optional[GoogleCloudLogging] = None,
|
247
|
+
):
|
248
|
+
super().__init__(
|
249
|
+
dir=dir,
|
250
|
+
type=BaseEnums.LoggerType.CONTROLLER,
|
251
|
+
environment=environment,
|
252
|
+
service_key=service_key,
|
253
|
+
client_key=None,
|
254
|
+
level=level,
|
255
|
+
google_cloud_logging=google_cloud_logging,
|
256
|
+
)
|
257
|
+
|
258
|
+
|
239
259
|
class DatabaseLogger(BaseLogger):
|
240
260
|
def __init__(
|
241
261
|
self,
|
@@ -276,6 +296,26 @@ class MiddlewareLogger(BaseLogger):
|
|
276
296
|
)
|
277
297
|
|
278
298
|
|
299
|
+
class RouterLogger(BaseLogger):
|
300
|
+
def __init__(
|
301
|
+
self,
|
302
|
+
dir: str,
|
303
|
+
environment: Optional[BaseEnums.EnvironmentType] = None,
|
304
|
+
service_key: Optional[BaseEnums.Service] = None,
|
305
|
+
level: BaseEnums.LoggerLevel = BaseEnums.LoggerLevel.INFO,
|
306
|
+
google_cloud_logging: Optional[GoogleCloudLogging] = None,
|
307
|
+
):
|
308
|
+
super().__init__(
|
309
|
+
dir=dir,
|
310
|
+
type=BaseEnums.LoggerType.ROUTER,
|
311
|
+
environment=environment,
|
312
|
+
service_key=service_key,
|
313
|
+
client_key=None,
|
314
|
+
level=level,
|
315
|
+
google_cloud_logging=google_cloud_logging,
|
316
|
+
)
|
317
|
+
|
318
|
+
|
279
319
|
class RepositoryLogger(BaseLogger):
|
280
320
|
def __init__(
|
281
321
|
self,
|
@@ -0,0 +1,7 @@
|
|
1
|
+
from user_agents.parsers import parse
|
2
|
+
from maleo_foundation.models.transfers.general.user_agent import UserAgent
|
3
|
+
|
4
|
+
|
5
|
+
def parse_user_agent(user_agent_string: str) -> UserAgent:
|
6
|
+
parsed_user_agent = parse(user_agent_string)
|
7
|
+
return UserAgent.model_validate(parsed_user_agent, from_attributes=True)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: maleo_foundation
|
3
|
-
Version: 0.3.
|
3
|
+
Version: 0.3.74
|
4
4
|
Summary: Foundation package for Maleo
|
5
5
|
Author-email: Agra Bima Yuda <agra@nexmedis.com>
|
6
6
|
License: MIT
|
@@ -98,6 +98,8 @@ Requires-Dist: starlette>=0.46.2
|
|
98
98
|
Requires-Dist: twine>=6.1.0
|
99
99
|
Requires-Dist: typing-inspection>=0.4.0
|
100
100
|
Requires-Dist: typing_extensions>=4.13.2
|
101
|
+
Requires-Dist: ua-parser>=1.0.1
|
102
|
+
Requires-Dist: ua-parser-builtins>=0.18.0.post1
|
101
103
|
Requires-Dist: urllib3>=2.4.0
|
102
104
|
Requires-Dist: uvicorn>=0.34.2
|
103
105
|
Requires-Dist: virtualenv>=20.31.2
|
@@ -1,9 +1,8 @@
|
|
1
1
|
maleo_foundation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
-
maleo_foundation/authentication.py,sha256=
|
3
|
-
maleo_foundation/
|
4
|
-
maleo_foundation/constants.py,sha256=cgW2TjXYEdQRoYCL3fMk3r5B2Yr-Av67CaEAdY5SZ6o,1529
|
2
|
+
maleo_foundation/authentication.py,sha256=JoFMNIyF1Jadk7bwlFyIZhnAYxceCU6FvngfVhuYIl4,959
|
3
|
+
maleo_foundation/constants.py,sha256=DBtHm-_XL95fOIhY-Bp0zFdYkHks9p2PHu6K0J-QSns,1597
|
5
4
|
maleo_foundation/controller_types.py,sha256=Q7kAjUenQ-7QgXdsVLLWKfvEl1_s7r_QfOoftDXT6lc,1097
|
6
|
-
maleo_foundation/enums.py,sha256=
|
5
|
+
maleo_foundation/enums.py,sha256=MsGZeyEzHPsRu5YDeKBueDvACDVqhQTQ27U2QjpaXJA,6446
|
7
6
|
maleo_foundation/extended_types.py,sha256=oOAYc5f89WcPt5OWEaNdeceENHiPVr4KDhdttg6bA_w,305
|
8
7
|
maleo_foundation/rest_controller_result.py,sha256=uZxBxZ5hB98q1B4hNyRigHcO0560NYfUjq8L662aOPw,2172
|
9
8
|
maleo_foundation/types.py,sha256=Tq50KOISbnsMslVGBCqlY77lRAQZa-UUFDGqqwRglow,2466
|
@@ -36,8 +35,8 @@ maleo_foundation/managers/cache.py,sha256=hML8vi2MXO2m2HeqB4eE6Ed4kl1iVXgEfpkB9t
|
|
36
35
|
maleo_foundation/managers/configuration.py,sha256=JmJFvKB6xCPwb8iYpwuNMpdcHfwPJYLFgXYcWwewMj8,1740
|
37
36
|
maleo_foundation/managers/credential.py,sha256=ZQFae0cdERVtTZ2OGUgC8W6lI1RIlm2vjsAnqf2R234,3088
|
38
37
|
maleo_foundation/managers/db.py,sha256=y0rQIg-vohhFUtck3v1LCdXov7XYjy9PFiCsVtcg8VI,6496
|
39
|
-
maleo_foundation/managers/middleware.py,sha256=
|
40
|
-
maleo_foundation/managers/service.py,sha256=
|
38
|
+
maleo_foundation/managers/middleware.py,sha256=_M3g3wvrMtoQb5BI9Wi97Z6hUk4RIXiv04-TKpTrXLQ,2335
|
39
|
+
maleo_foundation/managers/service.py,sha256=NipK18Rz6uCloa8sySiwbCZxgxbguU_yGINkgjYciiM,12807
|
41
40
|
maleo_foundation/managers/client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
42
41
|
maleo_foundation/managers/client/base.py,sha256=j48JYpcTzaGJPZzQAixPVCJtAB9EqDVxx-51hVGgw2k,5631
|
43
42
|
maleo_foundation/managers/client/maleo.py,sha256=ACZC-gvc36pwrqvEmEKeBDKAOAAqoRfuCXeAa6KrGBQ,3128
|
@@ -47,15 +46,15 @@ maleo_foundation/managers/client/google/parameter.py,sha256=emBgc1qCQcnETKYvwv35
|
|
47
46
|
maleo_foundation/managers/client/google/secret.py,sha256=fwqeVL0uyefuZrySpvP9PJ8u-0YuAxZ3Nd9nA6A4UlI,5274
|
48
47
|
maleo_foundation/managers/client/google/storage.py,sha256=k-y0LrgjVVUX4PbGLOgBUOt0BEiQKXoHH-U3KtG5Kc4,6829
|
49
48
|
maleo_foundation/managers/client/google/subscription.py,sha256=0a9T1jh0CGyLb9CyBiixdZYxmCzdg0X15VYebqYt5M4,5686
|
50
|
-
maleo_foundation/middlewares/authentication.py,sha256=
|
51
|
-
maleo_foundation/middlewares/base.py,sha256=
|
49
|
+
maleo_foundation/middlewares/authentication.py,sha256=blcFRorGRK_GcVWKBqFe_UBngX1lLa5DwxuxISnIx24,4238
|
50
|
+
maleo_foundation/middlewares/base.py,sha256=HdKPkGZEpmDZBcbs1Zs2yHRr3oA0-_qjbCh6bofhamA,21165
|
52
51
|
maleo_foundation/middlewares/cors.py,sha256=1QgRXOcURuEhBYMerclqbECgtAE4CFo0EhB4gJXu8Yg,2294
|
53
52
|
maleo_foundation/models/__init__.py,sha256=OlZXaeOhGXz_FppPm87jIOItnr-r179QhIcOWDOORyQ,248
|
54
53
|
maleo_foundation/models/responses.py,sha256=WNAz67ewOyWV0oHyiB_BF_-sfaoDF-FVzcwg4AulH1g,8824
|
55
54
|
maleo_foundation/models/table.py,sha256=k0-OtahF2KRmvFUL8TborT6PoIhGsyoVrPJBKGg1QbU,1855
|
56
55
|
maleo_foundation/models/schemas/__init__.py,sha256=tmjBCyG4uMRjiTbnbhIjZaR8q7zk0_J_CqnRzsSfoBQ,279
|
57
56
|
maleo_foundation/models/schemas/encryption.py,sha256=S86FGlcBhyGxxZ5ObNSHTjSDwBUlUtLOMoCAKd5wE34,687
|
58
|
-
maleo_foundation/models/schemas/general.py,sha256=
|
57
|
+
maleo_foundation/models/schemas/general.py,sha256=YFL-z7QX286FUvhW1qg9ynBqggMVi0tkXMp_I9rgBDc,4128
|
59
58
|
maleo_foundation/models/schemas/hash.py,sha256=jthDmu_VTBydffPruAIAiR8l0Xs6IrlgTptaP42zr1M,447
|
60
59
|
maleo_foundation/models/schemas/key.py,sha256=LSEDQpaCxavwp5je2O-ZNyOPtrFW_lXDywF9LK-An1w,622
|
61
60
|
maleo_foundation/models/schemas/parameter.py,sha256=OE1hg100lEa2IlGlT2Zz6PJ-OcC-6ZfDzsTOeJvvEig,3907
|
@@ -64,18 +63,23 @@ maleo_foundation/models/schemas/signature.py,sha256=h0sa91vnCaivmvlbqOd7RLiCz8qA
|
|
64
63
|
maleo_foundation/models/schemas/token.py,sha256=eh4k9rm_MoaCfGV3Nqa7yFH-PH7Ec6WY4RxHhbF4m5U,591
|
65
64
|
maleo_foundation/models/transfers/__init__.py,sha256=V5kdd8wuXqe78bQ7HG3a8vW3Rkke2wTr6mb5lC0IQJg,301
|
66
65
|
maleo_foundation/models/transfers/general/__init__.py,sha256=e7lZRjpwQ8utt1D3IkuWOVFsnCn64De0SvxdWLSezJ0,170
|
66
|
+
maleo_foundation/models/transfers/general/authentication.py,sha256=4YT-YHHrvp4B6FJjXbLTwUxHuOn0YVtRF4M1zYHdkv4,1046
|
67
|
+
maleo_foundation/models/transfers/general/authorization.py,sha256=BBE5Wblzg8CCi51HAZSGOj_hqSHhZsGOIBQ1hTPZ1Os,216
|
67
68
|
maleo_foundation/models/transfers/general/credentials.py,sha256=t6OhQb3DyGSfBpbqHsiJKzPbOVSEcuBTXqmw6f8H3UY,347
|
68
69
|
maleo_foundation/models/transfers/general/data.py,sha256=_J-Y5X2Nx8D1lpaR9ctpm54kUbxR7Vy00hO103uXtxE,1408
|
69
70
|
maleo_foundation/models/transfers/general/database.py,sha256=VQYnZa8dYrqucSQdzkaPSrzLd4SJnpU8LPytUrWErO0,1245
|
70
71
|
maleo_foundation/models/transfers/general/key.py,sha256=QV_kcxAlnrupBcGQK8tqz9FVYbivxwhgIsrmW7XDdME,845
|
71
|
-
maleo_foundation/models/transfers/general/operation.py,sha256=
|
72
|
-
maleo_foundation/models/transfers/general/request.py,sha256=
|
72
|
+
maleo_foundation/models/transfers/general/operation.py,sha256=OFU3-qjhW_xeDb7l85mw2aA7lG1cxi3dupaOgIuuN7s,8917
|
73
|
+
maleo_foundation/models/transfers/general/request.py,sha256=1nrWZZgLti9SKTeAhWCfn-2Eob7JvlKK1_qoCh4F9rw,1685
|
74
|
+
maleo_foundation/models/transfers/general/response.py,sha256=oCkxx6g-OaycsEZMuZweJF9yOUozo-sgMKnv5mea8PA,498
|
75
|
+
maleo_foundation/models/transfers/general/service.py,sha256=u9v4e-XuFxoRYjwFQRPZRO51RpqHbIISUuqNhJR71-o,294
|
73
76
|
maleo_foundation/models/transfers/general/settings.py,sha256=LOlPVB8ns8NAIVHKVYv13jtlUbkuPHHOwyMqFes0T30,1623
|
74
77
|
maleo_foundation/models/transfers/general/signature.py,sha256=TCTIy928EeBBeFLlyQ3_NozpR9FUcWXPQKIYIwyj66k,308
|
75
78
|
maleo_foundation/models/transfers/general/token.py,sha256=aF7IXEYS4EnWtWquZexnrXcJBOl5M1lneo7yu7IiKYg,5022
|
76
|
-
maleo_foundation/models/transfers/general/
|
79
|
+
maleo_foundation/models/transfers/general/user_agent.py,sha256=wYuYIvfvzPNe7Dz2PvYas_YNTO1MZraFxSR4triwUVU,809
|
80
|
+
maleo_foundation/models/transfers/general/configurations/__init__.py,sha256=0ud_qyFLPoebb7AjgLaKrpAivGw6JKieQXImHxI82ng,1751
|
77
81
|
maleo_foundation/models/transfers/general/configurations/database.py,sha256=4j465vki3bCNGogrJLmMmF1uEXc-sUfyhwMeuaR5JyM,706
|
78
|
-
maleo_foundation/models/transfers/general/configurations/middleware.py,sha256=
|
82
|
+
maleo_foundation/models/transfers/general/configurations/middleware.py,sha256=0gX7ILF4TV3-eai_sJI3g6yFLyNoPGr9OlNaG9mz8ow,1633
|
79
83
|
maleo_foundation/models/transfers/general/configurations/service.py,sha256=9ls5So7P50gE0T0HjlskDMooL0RO3VmQl_N0H8HwutU,365
|
80
84
|
maleo_foundation/models/transfers/general/configurations/cache/__init__.py,sha256=eCEeFFP4jN9FWFHWLadAnP1NoJH4CJQm7WRnXhmHUh0,264
|
81
85
|
maleo_foundation/models/transfers/general/configurations/cache/redis.py,sha256=SNnI7hm8giKfR2Kp5sD_fmxo4Q5fkRCdi9zMKwTKPCs,1331
|
@@ -118,19 +122,17 @@ maleo_foundation/utils/__init__.py,sha256=advf6IhKQOz64jbI0f9gyabHWa7ti8wTYDkYLD
|
|
118
122
|
maleo_foundation/utils/cache.py,sha256=PWNef00iA2m0g3boR7JbzrJQIRITf5nKgdCmMs3s6ag,1159
|
119
123
|
maleo_foundation/utils/client.py,sha256=KDkIEqGX6Tw07Z5HHW4HrG8IWUVkErlqnVijXnpWZGQ,2940
|
120
124
|
maleo_foundation/utils/controller.py,sha256=S69NluxjGCB_toAu3JDLi_izE0-x2ARE_7YK3V8T1Q0,7413
|
121
|
-
maleo_foundation/utils/extractor.py,sha256=
|
122
|
-
maleo_foundation/utils/logging.py,sha256=
|
125
|
+
maleo_foundation/utils/extractor.py,sha256=gCJf-X-mlpnONcXe7DfLqfbJVjeHiHBMi-G0u9U5iSw,3527
|
126
|
+
maleo_foundation/utils/logging.py,sha256=IZufHwMfIujwfPhSe4ad3ld5yFNLqWbbem0PRe2OWSE,11774
|
123
127
|
maleo_foundation/utils/merger.py,sha256=UGiuH0EUQJu0WlS1xdPUuvnsNknd3k0DODjdiOTiBdI,704
|
128
|
+
maleo_foundation/utils/parser.py,sha256=xkIMpG4z2pgAK7OsWmdlpSw63yjV9v7nNKY0nqEJouU,300
|
124
129
|
maleo_foundation/utils/query.py,sha256=mAoXadZuWx_ic6Z4VQ9K4GZxYgSNzpNS94W6xxqeFyg,8312
|
125
130
|
maleo_foundation/utils/repository.py,sha256=fZqmApZUG9KqwrfURvyAIw_-7Y9EsLngoAoNcjJphtQ,2951
|
126
131
|
maleo_foundation/utils/searcher.py,sha256=rcHa0pPZvLEk2MgI4qeGW-K6vlUy2eWTnwWzzT8yrKA,528
|
127
|
-
maleo_foundation/utils/dependencies/__init__.py,sha256=jJOo4uCTPiEvpgecsl4JEhKzuV85KaNxOd9PiRl-2ic,124
|
128
|
-
maleo_foundation/utils/dependencies/auth.py,sha256=3Z0b-Xi5PAKRKlbv-ZIT46YrQFkjiS7NhSDWZTOWm8I,650
|
129
|
-
maleo_foundation/utils/dependencies/context.py,sha256=pw18j6LZgHdJQVKCvRH71mFZ_li8jP_wIgbtBMLXpxQ,271
|
130
132
|
maleo_foundation/utils/exceptions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
131
|
-
maleo_foundation/utils/exceptions/client.py,sha256=
|
133
|
+
maleo_foundation/utils/exceptions/client.py,sha256=6tLm3ihawgxHVtctBSnH0NslJMgepY80vPdhPWQD-hA,10814
|
132
134
|
maleo_foundation/utils/exceptions/request.py,sha256=p6rfya7HuqlfrvxFZm3KgTf95mPkQ6QCBlLyhiRfGtw,1600
|
133
|
-
maleo_foundation/utils/exceptions/service.py,sha256=
|
135
|
+
maleo_foundation/utils/exceptions/service.py,sha256=aAzIvp2afsXSsTWHULxTw7KMrCyXwmJU2rn0eb9A2NU,10847
|
134
136
|
maleo_foundation/utils/formatter/__init__.py,sha256=qzn45FGoZeArJYmgFpdzKe-jp3yREGSrPfc4a-iZHe4,80
|
135
137
|
maleo_foundation/utils/formatter/case.py,sha256=VsDTkKVZgN5b5O4Q6hkEzIDTf635FHS2BF_eY-NNngQ,1359
|
136
138
|
maleo_foundation/utils/loaders/__init__.py,sha256=aBVS-zCBdb9t4Keh5cFJ4Vqv5lFHthJoHTaGPVjnvnU,284
|
@@ -140,7 +142,7 @@ maleo_foundation/utils/loaders/credential/__init__.py,sha256=g-cAxkTE2EtHaG8Tv52
|
|
140
142
|
maleo_foundation/utils/loaders/credential/google.py,sha256=GCJl-bsKSSxoE_ERAkIzRrRNIbIEeqYOhHwzFuBr0mk,6576
|
141
143
|
maleo_foundation/utils/loaders/key/__init__.py,sha256=RfqIbUxkdlx1xrbzJZPD_JHiRFNFLRuQs8JoUPCGCv4,108
|
142
144
|
maleo_foundation/utils/loaders/key/rsa.py,sha256=UXcP0rr4QVacTsHLNQuU05wcow5CHWz-JW-zsVxlbPs,4121
|
143
|
-
maleo_foundation-0.3.
|
144
|
-
maleo_foundation-0.3.
|
145
|
-
maleo_foundation-0.3.
|
146
|
-
maleo_foundation-0.3.
|
145
|
+
maleo_foundation-0.3.74.dist-info/METADATA,sha256=tz_KKWXLtaGTpCcyfN3R-E-N1LEy7CTY-yxjGVOr-BE,4230
|
146
|
+
maleo_foundation-0.3.74.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
147
|
+
maleo_foundation-0.3.74.dist-info/top_level.txt,sha256=_iBos3F_bhEOdjOnzeiEYSrCucasc810xXtLBXI8cQc,17
|
148
|
+
maleo_foundation-0.3.74.dist-info/RECORD,,
|
@@ -1,17 +0,0 @@
|
|
1
|
-
from fastapi import Security
|
2
|
-
from fastapi.requests import Request
|
3
|
-
from fastapi.security import HTTPAuthorizationCredentials
|
4
|
-
from maleo_foundation.authentication import Authentication
|
5
|
-
from maleo_foundation.authorization import TOKEN_SCHEME, Authorization
|
6
|
-
|
7
|
-
|
8
|
-
class AuthDependencies:
|
9
|
-
@staticmethod
|
10
|
-
def authentication(request: Request) -> Authentication:
|
11
|
-
return Authentication(credentials=request.auth, user=request.user)
|
12
|
-
|
13
|
-
@staticmethod
|
14
|
-
def authorization(
|
15
|
-
token: HTTPAuthorizationCredentials = Security(TOKEN_SCHEME),
|
16
|
-
) -> Authorization:
|
17
|
-
return Authorization(scheme=token.scheme, credentials=token.credentials)
|
@@ -1,8 +0,0 @@
|
|
1
|
-
from fastapi.requests import Request
|
2
|
-
from maleo_foundation.models.transfers.general.request import RequestContext
|
3
|
-
|
4
|
-
|
5
|
-
class ContextDependencies:
|
6
|
-
@staticmethod
|
7
|
-
def get_request_context(request: Request) -> RequestContext:
|
8
|
-
return request.state.request_context
|
File without changes
|
File without changes
|