maleo-foundation 0.1.32__py3-none-any.whl → 0.1.33__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.
@@ -40,7 +40,6 @@ class Settings(BaseSettings):
40
40
  PUBLIC_KEY_PATH:str = Field("/keys/maleo-public-key.pem", description="Maleo's public key path")
41
41
  KEY_PASSWORD:str = Field(..., description="Maleo key's password")
42
42
  CONFIGURATIONS_PATH:str = Field(..., description="Service's configuration file path")
43
- GCS_BUCKET_NAME:str = Field(..., description="Google cloud storage (GCS)'s bucket name")
44
43
 
45
44
  class Keys(BaseModel):
46
45
  password:str = Field(..., description="Key's password")
@@ -90,6 +89,12 @@ class DatabaseConfigurations(BaseModel):
90
89
  def url(self) -> str:
91
90
  return f"postgresql://{self.username}:{self.password}@{self.host}:{self.port}/{self.database}"
92
91
 
92
+ class GoogleCloudStorageConfigurations(BaseModel):
93
+ bucket_name:str = Field(..., description="Bucket's name")
94
+
95
+ class GoogleClientConfigurations(BaseModel):
96
+ storage:GoogleCloudStorageConfigurations = Field(..., description="Google cloud storage client configurations")
97
+
93
98
  class MaleoClientConfiguration(BaseModel):
94
99
  key:str = Field(..., description="Client's key")
95
100
  name:str = Field(..., description="Client's name")
@@ -113,8 +118,12 @@ class MaleoClientConfigurations(BaseModel):
113
118
  arbitrary_types_allowed=True
114
119
 
115
120
  class ClientConfigurations(BaseModel):
121
+ google:GoogleClientConfigurations = Field(..., description="Google client's configurations")
116
122
  maleo:MaleoClientConfigurations = Field(..., description="Maleo client's configurations")
117
123
 
124
+ class Config:
125
+ arbitrary_types_allowed=True
126
+
118
127
  class Configurations(BaseModel):
119
128
  service:ServiceConfigurations = Field(..., description="Service's configurations")
120
129
  middleware:MiddlewareConfigurations = Field(..., description="Middleware's configurations")
@@ -315,7 +324,7 @@ class ServiceManager:
315
324
  def _initialize_clients(self) -> None:
316
325
  #* Initialize google clients
317
326
  secret = GoogleSecretManager(**self._log_config.model_dump())
318
- storage = GoogleCloudStorage(**self._log_config.model_dump())
327
+ storage = GoogleCloudStorage(**self._log_config.model_dump(), bucket_name=self._configs.client.google.storage.bucket_name)
319
328
  self._google_clients = GoogleClientManagers(secret=secret, storage=storage)
320
329
  #* Initialize http clients
321
330
  self._http_client = HTTPClientManager
@@ -18,22 +18,22 @@ class Backend(AuthenticationBackend):
18
18
  async def authenticate(self, conn:HTTPConnection) -> Tuple[Credentials, User]:
19
19
  client_ip = extract_client_ip(conn)
20
20
  if "Authorization" not in conn.headers:
21
- self._logger.info(f"Authentication - Request | IP: {client_ip} | URL: {conn.url.path} - Result | General: Header did not contain authorization")
21
+ self._logger.info(f"Request | IP: {client_ip} | URL: {conn.url.path} - Result | General: Header did not contain authorization")
22
22
  return Credentials(), User(authenticated=False)
23
23
 
24
24
  auth = conn.headers["Authorization"]
25
25
  scheme, token = auth.split()
26
26
  if scheme != 'Bearer':
27
- self._logger.info(f"Authentication - Request | IP: {client_ip} | URL: {conn.url.path} - Result | General: Authorization scheme is not Bearer")
27
+ self._logger.info(f"Request | IP: {client_ip} | URL: {conn.url.path} - Result | General: Authorization scheme is not Bearer")
28
28
  return Credentials(), User(authenticated=False)
29
29
 
30
30
  decode_token_parameters = BaseTokenParametersTransfers.Decode(key=self._key, token=token)
31
31
  decode_token_result = BaseTokenService.decode(parameters=decode_token_parameters)
32
32
  if not decode_token_result.success:
33
- self._logger.error(f"Authentication - Request | IP: {client_ip} | URL: {conn.url.path} - Result | General: Failed decoding authorization token")
33
+ self._logger.error(f"Request | IP: {client_ip} | URL: {conn.url.path} - Result | General: Failed decoding authorization token")
34
34
  return Credentials(token=token), User(authenticated=False)
35
35
 
36
- self._logger.info(f"Authentication - Request | IP: {client_ip} | URL: {conn.url.path} - Result | Username: {decode_token_result.data.u_u} | Email: {decode_token_result.data.u_e}")
36
+ self._logger.info(f"Request | IP: {client_ip} | URL: {conn.url.path} - Result | Username: {decode_token_result.data.u_u} | Email: {decode_token_result.data.u_e}")
37
37
  return Credentials(token=token), User(authenticated=True, username=decode_token_result.data.u_u, email=decode_token_result.data.u_e)
38
38
 
39
39
  def add_authentication_middleware(app:FastAPI, logger:MiddlewareLogger, key:str) -> None:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: maleo_foundation
3
- Version: 0.1.32
3
+ Version: 0.1.33
4
4
  Summary: Foundation package for Maleo
5
5
  Author-email: Agra Bima Yuda <agra@nexmedis.com>
6
6
  License: MIT
@@ -32,7 +32,7 @@ maleo_foundation/expanded_types/token.py,sha256=4fRTJw6W5MYq71NksNrWNi7qYHQ4_lQw
32
32
  maleo_foundation/managers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
33
33
  maleo_foundation/managers/db.py,sha256=Jf0w-9JOAG5X2quDxqqw6d2WUIX7MYGdlPGxWP0rxHs,4699
34
34
  maleo_foundation/managers/middleware.py,sha256=7CDXPMb28AR7J72TWOeKFxOlMypKezEtO9mr53a88B0,4032
35
- maleo_foundation/managers/service.py,sha256=FVsMitDat1UYIsEz0S1HGHQhoP9Oj4AlcjIF1zyKmjM,20026
35
+ maleo_foundation/managers/service.py,sha256=JlE-aKAr0q0ztJ6I50_R2TcVctu6TaUWGoyHUEWgcIM,20423
36
36
  maleo_foundation/managers/client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
37
37
  maleo_foundation/managers/client/base.py,sha256=K8AFV2MTZrC1jbTqxkx7eedmxodJirNIjoRXGGcppy4,1022
38
38
  maleo_foundation/managers/client/http.py,sha256=dWFZlG1z4TERYBITReR5oSrlzvdhh2EtztVnsU8gCeA,2712
@@ -42,7 +42,7 @@ maleo_foundation/managers/client/google/base.py,sha256=1lrGoyGnYW5Xq05bVXbKqnsqq
42
42
  maleo_foundation/managers/client/google/secret.py,sha256=bWR_3Xl_wUFqj4M48w8ZE692U7PQKX9ap0ndDJviV80,3074
43
43
  maleo_foundation/managers/client/google/storage.py,sha256=041iSSaFubnZrP-pS8MiLVtOgeLQ591Iz64JekZ5K7o,2350
44
44
  maleo_foundation/middlewares/__init__.py,sha256=bqE2EIFC3rWcR2AwFPR0fk2kSFfeTRzgA24GbnuT5RA,3697
45
- maleo_foundation/middlewares/authentication.py,sha256=y67sWz6FLl6NAtUWyK4mxC661dsBeKsDYRH3o7L_ZFQ,3188
45
+ maleo_foundation/middlewares/authentication.py,sha256=j1IcNnsfVVgDL4eVPP3LARjh5rKHm2KUEfS3E3j7snc,3120
46
46
  maleo_foundation/middlewares/base.py,sha256=3OaB5F57F3epKNieoAgarYM6PimoUdUl3DgpadtVuqs,11743
47
47
  maleo_foundation/middlewares/cors.py,sha256=9uvBvY2N6Vxa9RP_YtESxcWo6Doi6uS0lzAG9iLY7Uc,2288
48
48
  maleo_foundation/models/__init__.py,sha256=AaKehO7c1HyKhoTGRmNHDddSeBXkW-_YNrpOGBu8Ms8,246
@@ -83,7 +83,7 @@ maleo_foundation/utils/logging.py,sha256=MwvZmZSA8SIdfq-knEvpYIgqnSpHcyHrZY9TVHW
83
83
  maleo_foundation/utils/query.py,sha256=ODQ3adOYQNj5E2cRW9ytbjBz56nEDcnfq8mQ6YZbCCM,4375
84
84
  maleo_foundation/utils/formatter/__init__.py,sha256=iKf5YCbEdg1qKnFHyKqqcQbqAqEeRUf8mhI3v3dQoj8,78
85
85
  maleo_foundation/utils/formatter/case.py,sha256=TmvvlfzGdC_omMTB5vAa40TZBxQ3hnr-SYeo0M52Rlg,1352
86
- maleo_foundation-0.1.32.dist-info/METADATA,sha256=kJKuK_VSe2qGOGE39crL6srneNL_X1LMUBOs_TTtCZ8,3190
87
- maleo_foundation-0.1.32.dist-info/WHEEL,sha256=0CuiUZ_p9E4cD6NyLD6UG80LBXYyiSYZOKDm5lp32xk,91
88
- maleo_foundation-0.1.32.dist-info/top_level.txt,sha256=_iBos3F_bhEOdjOnzeiEYSrCucasc810xXtLBXI8cQc,17
89
- maleo_foundation-0.1.32.dist-info/RECORD,,
86
+ maleo_foundation-0.1.33.dist-info/METADATA,sha256=QZECMQ-23FYQBioeOoYSKKA8I4eUTQpD1JobLMdX6p8,3190
87
+ maleo_foundation-0.1.33.dist-info/WHEEL,sha256=0CuiUZ_p9E4cD6NyLD6UG80LBXYyiSYZOKDm5lp32xk,91
88
+ maleo_foundation-0.1.33.dist-info/top_level.txt,sha256=_iBos3F_bhEOdjOnzeiEYSrCucasc810xXtLBXI8cQc,17
89
+ maleo_foundation-0.1.33.dist-info/RECORD,,