maleo-foundation 0.2.8__py3-none-any.whl → 0.2.10__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/authorization.py +8 -0
- maleo_foundation/managers/service.py +2 -4
- maleo_foundation/models/transfers/general/token.py +1 -1
- maleo_foundation/utils/dependencies/__init__.py +5 -0
- maleo_foundation/utils/dependencies/auth.py +14 -0
- {maleo_foundation-0.2.8.dist-info → maleo_foundation-0.2.10.dist-info}/METADATA +1 -1
- {maleo_foundation-0.2.8.dist-info → maleo_foundation-0.2.10.dist-info}/RECORD +9 -6
- {maleo_foundation-0.2.8.dist-info → maleo_foundation-0.2.10.dist-info}/WHEEL +0 -0
- {maleo_foundation-0.2.8.dist-info → maleo_foundation-0.2.10.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,8 @@
|
|
1
|
+
from fastapi.security import HTTPBearer
|
2
|
+
from pydantic import BaseModel, Field
|
3
|
+
|
4
|
+
TOKEN_SCHEME = HTTPBearer()
|
5
|
+
|
6
|
+
class Authorization(BaseModel):
|
7
|
+
scheme:str = Field(..., description="Authorization's scheme")
|
8
|
+
credentials:str = Field(..., description="Authorization's credentials")
|
@@ -257,9 +257,6 @@ class ServiceManager:
|
|
257
257
|
def foundation(self) -> MaleoFoundationClientManager:
|
258
258
|
return self._foundation
|
259
259
|
|
260
|
-
async def generate_token(self) -> BaseTypes.OptionalString:
|
261
|
-
raise NotImplementedError()
|
262
|
-
|
263
260
|
@property
|
264
261
|
def token(self) -> BaseTypes.OptionalString:
|
265
262
|
payload = MaleoFoundationTokenGeneralTransfers.BaseEncodePayload(
|
@@ -268,7 +265,8 @@ class ServiceManager:
|
|
268
265
|
sr="administrator",
|
269
266
|
u_u=self._maleo_credentials.username,
|
270
267
|
u_e=self._maleo_credentials.email,
|
271
|
-
u_ut="service"
|
268
|
+
u_ut="service",
|
269
|
+
exp_in=1
|
272
270
|
)
|
273
271
|
parameters = MaleoFoundationTokenParametersTransfers.Encode(key=self._keys.private, password=self._keys.password, payload=payload)
|
274
272
|
result = self._foundation.services.token.encode(parameters=parameters)
|
@@ -27,7 +27,7 @@ class MaleoFoundationTokenGeneralTransfers:
|
|
27
27
|
|
28
28
|
class EncodePayload(DecodePayload):
|
29
29
|
iat_dt:datetime = Field(datetime.now(timezone.utc), description="Issued at (datetime)")
|
30
|
-
exp_in:int = Field(
|
30
|
+
exp_in:int = Field(15, ge=1, description="Expires in (integer, minutes)", exclude=True)
|
31
31
|
|
32
32
|
@model_validator(mode="before")
|
33
33
|
@classmethod
|
@@ -0,0 +1,14 @@
|
|
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
|
+
class AuthDependencies:
|
8
|
+
@staticmethod
|
9
|
+
def authentication(request:Request) -> Authentication:
|
10
|
+
return Authentication(credentials=request.auth, user=request.user)
|
11
|
+
|
12
|
+
@staticmethod
|
13
|
+
def authorization(token:HTTPAuthorizationCredentials = Security(TOKEN_SCHEME)) -> Authorization:
|
14
|
+
return Authorization(scheme=token.scheme, credentials=token.credentials)
|
@@ -1,5 +1,6 @@
|
|
1
1
|
maleo_foundation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
2
|
maleo_foundation/authentication.py,sha256=kJfuRKgQY5cjmn0r36z4a4jF4bg7UifZ9D9mgMMnTsw,1840
|
3
|
+
maleo_foundation/authorization.py,sha256=euq24UEhTaimmM24Ies-kZF1zqVwM_x0Zox_6k7zyqI,281
|
3
4
|
maleo_foundation/constants.py,sha256=aBmEfWlBqZxi0k-n6h2NM1YRLOjMnheEiLyQcjP-zCQ,1164
|
4
5
|
maleo_foundation/enums.py,sha256=uvwl3dl2r6BoJMEbtSETiLoyJubHup9Lc7VOg7w7zQo,2943
|
5
6
|
maleo_foundation/extended_types.py,sha256=pIKt-_9tby4rmune3fmWcCW_mohaNRh_1lywBmdc-L4,301
|
@@ -32,7 +33,7 @@ maleo_foundation/expanded_types/encryption/rsa.py,sha256=MuhB_DGrjnsl4t96W4pKuCt
|
|
32
33
|
maleo_foundation/managers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
33
34
|
maleo_foundation/managers/db.py,sha256=Pn5EZ-c1Hy6-BihN7KokHJWmBIt3Ty96fZ0zF-srtF4,5208
|
34
35
|
maleo_foundation/managers/middleware.py,sha256=ODIQU1Hpu-Xempjjo_VRbVtxiD5oi74mNuoWuDawRh0,4250
|
35
|
-
maleo_foundation/managers/service.py,sha256=
|
36
|
+
maleo_foundation/managers/service.py,sha256=MEAoL2zab3k0d894zwP4Sem3Na38jS2gFsAiEJUmXZM,16110
|
36
37
|
maleo_foundation/managers/client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
37
38
|
maleo_foundation/managers/client/base.py,sha256=5z9l2GN4QASF0-Lft8o5QQ3SRPXqeNZNT1S1CgaE764,4384
|
38
39
|
maleo_foundation/managers/client/maleo.py,sha256=iCM47TLL-RSQ2FkTmHVPdsb2JCd1LebMx6OJvIr4vCQ,2035
|
@@ -59,7 +60,7 @@ maleo_foundation/models/transfers/__init__.py,sha256=oJLJ3Geeme6vBw7R2Dhvdvg4ziV
|
|
59
60
|
maleo_foundation/models/transfers/general/__init__.py,sha256=UPIE9l9XXCb6nWzaV3atMgbbCeBeRzsvFyROJuH2d2w,168
|
60
61
|
maleo_foundation/models/transfers/general/key.py,sha256=tLKkXbwNu7Oc1MdKa8-Y7TlBAIk54h_02AmL5Yg2PrQ,751
|
61
62
|
maleo_foundation/models/transfers/general/signature.py,sha256=J9xQy2HjpCQOnES7RJqsUnDgjFPuakQ1mxyfdTdstSE,297
|
62
|
-
maleo_foundation/models/transfers/general/token.py,sha256=
|
63
|
+
maleo_foundation/models/transfers/general/token.py,sha256=QckgF39hRAFU9GNXZsQ20kfaGom5Ppw5ShYaqDbeje8,2698
|
63
64
|
maleo_foundation/models/transfers/parameters/__init__.py,sha256=oKW4RPIEISISRjsJzD8lsCGY1HhZRTzshPpWHcJu86k,353
|
64
65
|
maleo_foundation/models/transfers/parameters/client.py,sha256=tn_Hwa-k-Utp5rODe7GylqZB8djIKKupgkUFscYCyLc,4059
|
65
66
|
maleo_foundation/models/transfers/parameters/general.py,sha256=WoekZJCIoAllhXdRIJkNRdNq0QEIn0bteiHJLtzkCxU,579
|
@@ -98,6 +99,8 @@ maleo_foundation/utils/extractor.py,sha256=SZXVYDHWGaA-Dd1BUydwF2HHdZqexEielS4Cj
|
|
98
99
|
maleo_foundation/utils/logging.py,sha256=W5Fhk_xAXVqSujaY8mv3hRH4wlQSpUn4ReuMoiKcQa4,7759
|
99
100
|
maleo_foundation/utils/mergers.py,sha256=DniUu3Ot4qkYH_YSw4uD1cn9cfirum4S_Opp8fMkQwA,702
|
100
101
|
maleo_foundation/utils/query.py,sha256=ODQ3adOYQNj5E2cRW9ytbjBz56nEDcnfq8mQ6YZbCCM,4375
|
102
|
+
maleo_foundation/utils/dependencies/__init__.py,sha256=0KKGrdfj8Cc5A4SRk_ZBAxzOP795Mizdb4zIBh07KC4,122
|
103
|
+
maleo_foundation/utils/dependencies/auth.py,sha256=sZgW1VPmUfpGTS7522qlAXPz_86ZPnuBZvzulT0IlQw,631
|
101
104
|
maleo_foundation/utils/formatter/__init__.py,sha256=iKf5YCbEdg1qKnFHyKqqcQbqAqEeRUf8mhI3v3dQoj8,78
|
102
105
|
maleo_foundation/utils/formatter/case.py,sha256=TmvvlfzGdC_omMTB5vAa40TZBxQ3hnr-SYeo0M52Rlg,1352
|
103
106
|
maleo_foundation/utils/loaders/__init__.py,sha256=P_3ycGfeDXFjAi8bE4iLWHxBveqUIdpHgGv-klRWM3s,282
|
@@ -107,7 +110,7 @@ maleo_foundation/utils/loaders/credential/__init__.py,sha256=qopTKvcMVoTFwyRijeg
|
|
107
110
|
maleo_foundation/utils/loaders/credential/google.py,sha256=deksZXT5wPhEsSMHbZ3x05WHXxCjLDt76Ns-1Tmhp7g,948
|
108
111
|
maleo_foundation/utils/loaders/key/__init__.py,sha256=hVygcC2ImHc_aVrSrOmyedR8tMUZokWUKCKOSh5ctbo,106
|
109
112
|
maleo_foundation/utils/loaders/key/rsa.py,sha256=gDhyX6iTFtHiluuhFCozaZ3pOLKU2Y9TlrNMK_GVyGU,3796
|
110
|
-
maleo_foundation-0.2.
|
111
|
-
maleo_foundation-0.2.
|
112
|
-
maleo_foundation-0.2.
|
113
|
-
maleo_foundation-0.2.
|
113
|
+
maleo_foundation-0.2.10.dist-info/METADATA,sha256=qe6cdo5afdbsaWdCmuED0l-e3RBY5656mbIKOOouZLE,3419
|
114
|
+
maleo_foundation-0.2.10.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
|
115
|
+
maleo_foundation-0.2.10.dist-info/top_level.txt,sha256=_iBos3F_bhEOdjOnzeiEYSrCucasc810xXtLBXI8cQc,17
|
116
|
+
maleo_foundation-0.2.10.dist-info/RECORD,,
|
File without changes
|
File without changes
|