maleo-foundation 0.2.39__py3-none-any.whl → 0.2.41__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 +6 -14
- maleo_foundation/middlewares/authentication.py +6 -6
- maleo_foundation/models/transfers/general/token.py +2 -2
- {maleo_foundation-0.2.39.dist-info → maleo_foundation-0.2.41.dist-info}/METADATA +1 -1
- {maleo_foundation-0.2.39.dist-info → maleo_foundation-0.2.41.dist-info}/RECORD +7 -7
- {maleo_foundation-0.2.39.dist-info → maleo_foundation-0.2.41.dist-info}/WHEEL +1 -1
- {maleo_foundation-0.2.39.dist-info → maleo_foundation-0.2.41.dist-info}/top_level.txt +0 -0
@@ -5,31 +5,23 @@ from maleo_foundation.enums import BaseEnums
|
|
5
5
|
from maleo_foundation.models.transfers.general.token import MaleoFoundationTokenGeneralTransfers
|
6
6
|
from maleo_foundation.types import BaseTypes
|
7
7
|
|
8
|
+
class Token(BaseModel):
|
9
|
+
type:BaseEnums.TokenType = Field(..., description="Token's type")
|
10
|
+
payload:MaleoFoundationTokenGeneralTransfers.DecodePayload = Field(..., description="Token's payload")
|
11
|
+
|
8
12
|
class Credentials(AuthCredentials):
|
9
13
|
def __init__(
|
10
14
|
self,
|
11
|
-
|
12
|
-
token:BaseTypes.OptionalString = None,
|
13
|
-
payload:Optional[MaleoFoundationTokenGeneralTransfers.DecodePayload] = None,
|
15
|
+
token:Optional[Token] = None,
|
14
16
|
scopes:Optional[Sequence[str]] = None
|
15
17
|
) -> None:
|
16
|
-
self._token_type = token_type
|
17
18
|
self._token = token
|
18
|
-
self._payload = payload
|
19
19
|
super().__init__(scopes)
|
20
20
|
|
21
21
|
@property
|
22
|
-
def
|
23
|
-
return self._token_type
|
24
|
-
|
25
|
-
@property
|
26
|
-
def token(self) -> BaseTypes.OptionalString:
|
22
|
+
def token(self) -> Optional[Token]:
|
27
23
|
return self._token
|
28
24
|
|
29
|
-
@property
|
30
|
-
def payload(self) -> Optional[MaleoFoundationTokenGeneralTransfers.DecodePayload]:
|
31
|
-
return self._payload
|
32
|
-
|
33
25
|
class User(BaseUser):
|
34
26
|
def __init__(
|
35
27
|
self,
|
@@ -3,7 +3,7 @@ from starlette.authentication import AuthenticationBackend, AuthenticationError
|
|
3
3
|
from starlette.middleware.authentication import AuthenticationMiddleware
|
4
4
|
from starlette.requests import HTTPConnection
|
5
5
|
from typing import Tuple
|
6
|
-
from maleo_foundation.authentication import Credentials, User
|
6
|
+
from maleo_foundation.authentication import Token, Credentials, User
|
7
7
|
from maleo_foundation.enums import BaseEnums
|
8
8
|
from maleo_foundation.client.manager import MaleoFoundationClientManager
|
9
9
|
from maleo_foundation.models.schemas import BaseGeneralSchemas
|
@@ -33,7 +33,7 @@ class Backend(AuthenticationBackend):
|
|
33
33
|
scheme, token = parts
|
34
34
|
if scheme != 'Bearer':
|
35
35
|
raise AuthenticationError("Authorization scheme must be Bearer token")
|
36
|
-
|
36
|
+
|
37
37
|
#* Decode token
|
38
38
|
decode_token_parameters = (
|
39
39
|
MaleoFoundationTokenParametersTransfers
|
@@ -44,12 +44,12 @@ class Backend(AuthenticationBackend):
|
|
44
44
|
.decode(parameters=decode_token_parameters)
|
45
45
|
)
|
46
46
|
if decode_token_result.success:
|
47
|
+
type = BaseEnums.TokenType.ACCESS
|
47
48
|
payload = decode_token_result.data
|
49
|
+
token = Token(type, payload)
|
48
50
|
return (
|
49
51
|
Credentials(
|
50
|
-
token_type=BaseEnums.TokenType.ACCESS,
|
51
52
|
token=token,
|
52
|
-
payload=payload,
|
53
53
|
scopes=["authenticated", payload.sr]
|
54
54
|
),
|
55
55
|
User(
|
@@ -71,12 +71,12 @@ class Backend(AuthenticationBackend):
|
|
71
71
|
.decode(parameters=decode_token_parameters)
|
72
72
|
)
|
73
73
|
if decode_token_result.success:
|
74
|
+
type = BaseEnums.TokenType.ACCESS
|
74
75
|
payload = decode_token_result.data
|
76
|
+
token = Token(type, payload)
|
75
77
|
return (
|
76
78
|
Credentials(
|
77
|
-
token_type=BaseEnums.TokenType.REFRESH,
|
78
79
|
token=token,
|
79
|
-
payload=payload,
|
80
80
|
scopes=["authenticated", payload.sr]
|
81
81
|
),
|
82
82
|
User(
|
@@ -8,9 +8,9 @@ from maleo_foundation.models.schemas.token import MaleoFoundationTokenSchemas
|
|
8
8
|
class MaleoFoundationTokenGeneralTransfers:
|
9
9
|
class BasePayload(BaseModel):
|
10
10
|
iss:BaseTypes.OptionalString = Field(None, description="Token's issuer")
|
11
|
-
sub:
|
11
|
+
sub:str = Field(..., description="Token's subject")
|
12
12
|
sr:str = Field(..., description="System role")
|
13
|
-
u_i:
|
13
|
+
u_i:int = Field(..., description="user's id")
|
14
14
|
u_uu:UUID = Field(..., description="user's uuid")
|
15
15
|
u_u:str = Field(..., description="user's username")
|
16
16
|
u_e:str = Field(..., description="user's email")
|
@@ -1,5 +1,5 @@
|
|
1
1
|
maleo_foundation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
-
maleo_foundation/authentication.py,sha256=
|
2
|
+
maleo_foundation/authentication.py,sha256=kmM2QKh0st2p2pac9MKP7yYNpJzI0cFwTOrMtoQ0gMI,1575
|
3
3
|
maleo_foundation/authorization.py,sha256=euq24UEhTaimmM24Ies-kZF1zqVwM_x0Zox_6k7zyqI,281
|
4
4
|
maleo_foundation/constants.py,sha256=aBmEfWlBqZxi0k-n6h2NM1YRLOjMnheEiLyQcjP-zCQ,1164
|
5
5
|
maleo_foundation/enums.py,sha256=OLVgb0rKk2gfG19FEyq9YGrQcmovr_FgtGFUcIu23Lo,3596
|
@@ -46,7 +46,7 @@ maleo_foundation/managers/client/google/base.py,sha256=eIdd6C2BFIu4EyZ1j017VZaJn
|
|
46
46
|
maleo_foundation/managers/client/google/parameter.py,sha256=Lnj7mQgxWQpsQwbmDRK5_bF01M1QpM5PS0eZP2q17yQ,1337
|
47
47
|
maleo_foundation/managers/client/google/secret.py,sha256=Ski1CHYeA8vjSk2Oc2Pf4CfFrzT_RcA6NEZwza7gM7Y,4464
|
48
48
|
maleo_foundation/managers/client/google/storage.py,sha256=ECyEBgEvvbTDVfqXey-meGnoU4qvIRU32BxbCuzcaHU,2576
|
49
|
-
maleo_foundation/middlewares/authentication.py,sha256=
|
49
|
+
maleo_foundation/middlewares/authentication.py,sha256=yfM9e0YJqwFrLNkUk8eIJVJ-eyRY6u4c1yrWUmVMJuc,4678
|
50
50
|
maleo_foundation/middlewares/base.py,sha256=8_ENtyB2iKejCOQofESzlAaq_zxDWtHNaq3f10dA020,14554
|
51
51
|
maleo_foundation/middlewares/cors.py,sha256=9uvBvY2N6Vxa9RP_YtESxcWo6Doi6uS0lzAG9iLY7Uc,2288
|
52
52
|
maleo_foundation/models/__init__.py,sha256=AaKehO7c1HyKhoTGRmNHDddSeBXkW-_YNrpOGBu8Ms8,246
|
@@ -65,7 +65,7 @@ maleo_foundation/models/transfers/__init__.py,sha256=oJLJ3Geeme6vBw7R2Dhvdvg4ziV
|
|
65
65
|
maleo_foundation/models/transfers/general/__init__.py,sha256=UPIE9l9XXCb6nWzaV3atMgbbCeBeRzsvFyROJuH2d2w,168
|
66
66
|
maleo_foundation/models/transfers/general/key.py,sha256=tLKkXbwNu7Oc1MdKa8-Y7TlBAIk54h_02AmL5Yg2PrQ,751
|
67
67
|
maleo_foundation/models/transfers/general/signature.py,sha256=J9xQy2HjpCQOnES7RJqsUnDgjFPuakQ1mxyfdTdstSE,297
|
68
|
-
maleo_foundation/models/transfers/general/token.py,sha256=
|
68
|
+
maleo_foundation/models/transfers/general/token.py,sha256=O_U6dQS7oMScJzqufl6Pe21pTxMsYhOzKH8aFLxjblQ,2895
|
69
69
|
maleo_foundation/models/transfers/parameters/__init__.py,sha256=oKW4RPIEISISRjsJzD8lsCGY1HhZRTzshPpWHcJu86k,353
|
70
70
|
maleo_foundation/models/transfers/parameters/client.py,sha256=3X1iCThKr72_vds4gdldB0YxTlXoLTF1rGbsXyjyBpg,4051
|
71
71
|
maleo_foundation/models/transfers/parameters/general.py,sha256=WoekZJCIoAllhXdRIJkNRdNq0QEIn0bteiHJLtzkCxU,579
|
@@ -117,7 +117,7 @@ maleo_foundation/utils/loaders/credential/__init__.py,sha256=qopTKvcMVoTFwyRijeg
|
|
117
117
|
maleo_foundation/utils/loaders/credential/google.py,sha256=SKsqPuFnAiCcYLf24CxKnMybhVHpgqnq1gGSlThqjts,994
|
118
118
|
maleo_foundation/utils/loaders/key/__init__.py,sha256=hVygcC2ImHc_aVrSrOmyedR8tMUZokWUKCKOSh5ctbo,106
|
119
119
|
maleo_foundation/utils/loaders/key/rsa.py,sha256=gDhyX6iTFtHiluuhFCozaZ3pOLKU2Y9TlrNMK_GVyGU,3796
|
120
|
-
maleo_foundation-0.2.
|
121
|
-
maleo_foundation-0.2.
|
122
|
-
maleo_foundation-0.2.
|
123
|
-
maleo_foundation-0.2.
|
120
|
+
maleo_foundation-0.2.41.dist-info/METADATA,sha256=DLgcwbVIoByJAS1mCAYMd5QD18S1MvskFTAkKio7ceM,3598
|
121
|
+
maleo_foundation-0.2.41.dist-info/WHEEL,sha256=zaaOINJESkSfm_4HQVc5ssNzHCPXhJm0kEUakpsEHaU,91
|
122
|
+
maleo_foundation-0.2.41.dist-info/top_level.txt,sha256=_iBos3F_bhEOdjOnzeiEYSrCucasc810xXtLBXI8cQc,17
|
123
|
+
maleo_foundation-0.2.41.dist-info/RECORD,,
|
File without changes
|