maleo-foundation 0.1.93__py3-none-any.whl → 0.1.95__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/managers/service.py +15 -8
- maleo_foundation/middlewares/authentication.py +6 -3
- maleo_foundation/utils/loaders/json.py +6 -2
- maleo_foundation/utils/loaders/yaml.py +6 -2
- {maleo_foundation-0.1.93.dist-info → maleo_foundation-0.1.95.dist-info}/METADATA +1 -1
- {maleo_foundation-0.1.93.dist-info → maleo_foundation-0.1.95.dist-info}/RECORD +8 -8
- {maleo_foundation-0.1.93.dist-info → maleo_foundation-0.1.95.dist-info}/WHEEL +0 -0
- {maleo_foundation-0.1.93.dist-info → maleo_foundation-0.1.95.dist-info}/top_level.txt +0 -0
@@ -177,23 +177,30 @@ class ServiceManager:
|
|
177
177
|
return self._maleo_credentials
|
178
178
|
|
179
179
|
def _load_configs(self) -> None:
|
180
|
+
#* Load static configurations
|
180
181
|
static_configurations_path = Path(self._settings.STATIC_CONFIGURATIONS_PATH)
|
181
182
|
if static_configurations_path.exists() and static_configurations_path.is_file():
|
182
|
-
static_configurations = YAMLLoader.
|
183
|
-
static_configs = StaticConfigurations.model_validate(static_configurations)
|
183
|
+
static_configurations = YAMLLoader.load_from_path(self._settings.STATIC_CONFIGURATIONS_PATH)
|
184
184
|
else:
|
185
|
-
|
186
|
-
|
185
|
+
data = self._secret_manager.get(f"maleo-static-config-{self._settings.ENVIRONMENT}")
|
186
|
+
static_configurations = YAMLLoader.load_from_string(data)
|
187
|
+
static_configs = StaticConfigurations.model_validate(static_configurations)
|
188
|
+
|
189
|
+
#* Load runtime configurations
|
187
190
|
runtime_configurations_path = Path(self._settings.RUNTIME_CONFIGURATIONS_PATH)
|
188
191
|
if runtime_configurations_path.exists() and runtime_configurations_path.is_file():
|
189
|
-
runtime_configurations = YAMLLoader.
|
190
|
-
runtime_configs = RuntimeConfigurations.model_validate(runtime_configurations)
|
192
|
+
runtime_configurations = YAMLLoader.load_from_path(self._settings.RUNTIME_CONFIGURATIONS_PATH)
|
191
193
|
else:
|
192
|
-
|
193
|
-
|
194
|
+
data = self._secret_manager.get(f"{self._settings.SERVICE_KEY}-runtime-config-{self._settings.ENVIRONMENT}")
|
195
|
+
runtime_configurations = YAMLLoader.load_from_string(data)
|
196
|
+
runtime_configs = RuntimeConfigurations.model_validate(runtime_configurations)
|
197
|
+
|
198
|
+
#* Load database configurations
|
194
199
|
password = self._secret_manager.get(name=f"maleo-db-password-{self._settings.ENVIRONMENT}")
|
195
200
|
host = self._secret_manager.get(name=f"maleo-db-host-{self._settings.ENVIRONMENT}")
|
196
201
|
database = DatabaseConfigurations(password=password, host=host, database=runtime_configs.database)
|
202
|
+
|
203
|
+
#* Load whole configurations
|
197
204
|
merged_configs = BaseMergers.deep_merge(static_configs.model_dump(), runtime_configs.model_dump(exclude={"database"}), {"database": database.model_dump()})
|
198
205
|
self._configs = Configurations.model_validate(merged_configs)
|
199
206
|
|
@@ -25,14 +25,17 @@ class Backend(AuthenticationBackend):
|
|
25
25
|
auth = conn.headers["Authorization"]
|
26
26
|
scheme, token = auth.split()
|
27
27
|
if scheme != 'Bearer':
|
28
|
-
raise AuthenticationError("Authorization scheme must be Bearer token")
|
28
|
+
# raise AuthenticationError("Authorization scheme must be Bearer token")
|
29
|
+
return Credentials(), User(authenticated=False)
|
29
30
|
|
30
31
|
decode_token_parameters = MaleoFoundationTokenParametersTransfers.Decode(key=self._keys.public, token=token)
|
31
32
|
decode_token_result = self._maleo_foundation.services.token.decode(parameters=decode_token_parameters)
|
32
33
|
if not decode_token_result.success:
|
33
|
-
raise AuthenticationError("Invalid Bearer token, unable to decode token")
|
34
|
+
# raise AuthenticationError("Invalid Bearer token, unable to decode token")
|
35
|
+
return Credentials(), User(authenticated=False)
|
34
36
|
if decode_token_result.data.exp_dt <= datetime.now(tz=timezone.utc):
|
35
|
-
raise AuthenticationError("Expired Bearer token, request new or refresh token")
|
37
|
+
# raise AuthenticationError("Expired Bearer token, request new or refresh token")
|
38
|
+
return Credentials(), User(authenticated=False)
|
36
39
|
|
37
40
|
payload = decode_token_result.data
|
38
41
|
return (
|
@@ -4,11 +4,15 @@ from pathlib import Path
|
|
4
4
|
|
5
5
|
class JSONLoader:
|
6
6
|
@staticmethod
|
7
|
-
def
|
7
|
+
def load_from_path(path:Union[Path, str]) -> Union[Dict[str, Any], List[Any]]:
|
8
8
|
file_path = Path(path)
|
9
9
|
|
10
10
|
if not file_path.is_file():
|
11
11
|
raise FileNotFoundError(f"File not found: {file_path}")
|
12
12
|
|
13
13
|
with open(file_path, 'r') as f:
|
14
|
-
return json.load(f)
|
14
|
+
return json.load(f)
|
15
|
+
|
16
|
+
@staticmethod
|
17
|
+
def load_from_string(string:str) -> Dict:
|
18
|
+
return json.loads(string)
|
@@ -4,11 +4,15 @@ from typing import Dict, Union
|
|
4
4
|
|
5
5
|
class YAMLLoader:
|
6
6
|
@staticmethod
|
7
|
-
def
|
7
|
+
def load_from_path(path:Union[Path, str]) -> Dict:
|
8
8
|
file_path = Path(path)
|
9
9
|
|
10
10
|
if not file_path.exists() or not file_path.is_file():
|
11
11
|
raise FileNotFoundError(f"File not found: {file_path}")
|
12
12
|
|
13
13
|
with file_path.open("r") as f:
|
14
|
-
return yaml.safe_load(f)
|
14
|
+
return yaml.safe_load(f)
|
15
|
+
|
16
|
+
@staticmethod
|
17
|
+
def load_from_string(string:str) -> Dict:
|
18
|
+
return yaml.safe_load(string)
|
@@ -32,7 +32,7 @@ maleo_foundation/expanded_types/encryption/rsa.py,sha256=MuhB_DGrjnsl4t96W4pKuCt
|
|
32
32
|
maleo_foundation/managers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
33
33
|
maleo_foundation/managers/db.py,sha256=Pn5EZ-c1Hy6-BihN7KokHJWmBIt3Ty96fZ0zF-srtF4,5208
|
34
34
|
maleo_foundation/managers/middleware.py,sha256=ODIQU1Hpu-Xempjjo_VRbVtxiD5oi74mNuoWuDawRh0,4250
|
35
|
-
maleo_foundation/managers/service.py,sha256=
|
35
|
+
maleo_foundation/managers/service.py,sha256=uw9ec4nI1r3ehYZaRSvWSQx8KCc515UFGkGyDbe0hx4,15702
|
36
36
|
maleo_foundation/managers/client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
37
37
|
maleo_foundation/managers/client/base.py,sha256=5z9l2GN4QASF0-Lft8o5QQ3SRPXqeNZNT1S1CgaE764,4384
|
38
38
|
maleo_foundation/managers/client/maleo.py,sha256=iCM47TLL-RSQ2FkTmHVPdsb2JCd1LebMx6OJvIr4vCQ,2035
|
@@ -40,7 +40,7 @@ maleo_foundation/managers/client/google/__init__.py,sha256=47DEQpj8HBSa-_TImW-5J
|
|
40
40
|
maleo_foundation/managers/client/google/base.py,sha256=eIdd6C2BFIu4EyZ1j017VZaJn_nSTPGFftBwQmVAUDA,1366
|
41
41
|
maleo_foundation/managers/client/google/secret.py,sha256=Ski1CHYeA8vjSk2Oc2Pf4CfFrzT_RcA6NEZwza7gM7Y,4464
|
42
42
|
maleo_foundation/managers/client/google/storage.py,sha256=JFqXd9QgusT75KAWyWdin8V6BbbKcbBCrmWDpqg6i3Q,2530
|
43
|
-
maleo_foundation/middlewares/authentication.py,sha256=
|
43
|
+
maleo_foundation/middlewares/authentication.py,sha256=hBGaMiCt0CnUw7sg4PZJ3kFJ0OVXvkOR5LhZcz9QUU8,3545
|
44
44
|
maleo_foundation/middlewares/base.py,sha256=g4cg9gIUveK9zbjhwQtkdefhuoSlv9BUWVCFaSlOClw,13303
|
45
45
|
maleo_foundation/middlewares/cors.py,sha256=9uvBvY2N6Vxa9RP_YtESxcWo6Doi6uS0lzAG9iLY7Uc,2288
|
46
46
|
maleo_foundation/models/__init__.py,sha256=AaKehO7c1HyKhoTGRmNHDddSeBXkW-_YNrpOGBu8Ms8,246
|
@@ -101,13 +101,13 @@ maleo_foundation/utils/query.py,sha256=ODQ3adOYQNj5E2cRW9ytbjBz56nEDcnfq8mQ6YZbC
|
|
101
101
|
maleo_foundation/utils/formatter/__init__.py,sha256=iKf5YCbEdg1qKnFHyKqqcQbqAqEeRUf8mhI3v3dQoj8,78
|
102
102
|
maleo_foundation/utils/formatter/case.py,sha256=TmvvlfzGdC_omMTB5vAa40TZBxQ3hnr-SYeo0M52Rlg,1352
|
103
103
|
maleo_foundation/utils/loaders/__init__.py,sha256=P_3ycGfeDXFjAi8bE4iLWHxBveqUIdpHgGv-klRWM3s,282
|
104
|
-
maleo_foundation/utils/loaders/json.py,sha256=
|
105
|
-
maleo_foundation/utils/loaders/yaml.py,sha256=
|
104
|
+
maleo_foundation/utils/loaders/json.py,sha256=8e3qe1TyL-jaJVuiQJpVHKDBS2n_CGJPGv8Ci6cK42Y,506
|
105
|
+
maleo_foundation/utils/loaders/yaml.py,sha256=8cZWOYuDTAFNrLsUlz7IGyOrtR4oL-tk-jc7q_7nq8Q,501
|
106
106
|
maleo_foundation/utils/loaders/credential/__init__.py,sha256=qopTKvcMVoTFwyRijeg7rejnG4I684FjUwh70tvhtVM,141
|
107
107
|
maleo_foundation/utils/loaders/credential/google.py,sha256=deksZXT5wPhEsSMHbZ3x05WHXxCjLDt76Ns-1Tmhp7g,948
|
108
108
|
maleo_foundation/utils/loaders/key/__init__.py,sha256=hVygcC2ImHc_aVrSrOmyedR8tMUZokWUKCKOSh5ctbo,106
|
109
109
|
maleo_foundation/utils/loaders/key/rsa.py,sha256=gDhyX6iTFtHiluuhFCozaZ3pOLKU2Y9TlrNMK_GVyGU,3796
|
110
|
-
maleo_foundation-0.1.
|
111
|
-
maleo_foundation-0.1.
|
112
|
-
maleo_foundation-0.1.
|
113
|
-
maleo_foundation-0.1.
|
110
|
+
maleo_foundation-0.1.95.dist-info/METADATA,sha256=c_7w_2V0-8MtnO27MUKZVzRQYfRR9alWLi-KnUWGPm8,3419
|
111
|
+
maleo_foundation-0.1.95.dist-info/WHEEL,sha256=DnLRTWE75wApRYVsjgc6wsVswC54sMSJhAEd4xhDpBk,91
|
112
|
+
maleo_foundation-0.1.95.dist-info/top_level.txt,sha256=_iBos3F_bhEOdjOnzeiEYSrCucasc810xXtLBXI8cQc,17
|
113
|
+
maleo_foundation-0.1.95.dist-info/RECORD,,
|
File without changes
|
File without changes
|