maleo-foundation 0.3.43__py3-none-any.whl → 0.3.44__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.
@@ -1,4 +1,4 @@
1
- from pydantic import BaseModel, ConfigDict, Field
1
+ from pydantic import BaseModel, ConfigDict, Field, field_serializer
2
2
  from starlette.authentication import AuthCredentials, BaseUser
3
3
  from typing import Optional, Sequence
4
4
  from maleo_foundation.enums import BaseEnums
@@ -48,4 +48,19 @@ class Authentication(BaseModel):
48
48
  model_config = ConfigDict(arbitrary_types_allowed=True)
49
49
 
50
50
  credentials: Credentials = Field(..., description="Credentials's information")
51
- user: User = Field(..., description="User's information")
51
+ user: User = Field(..., description="User's information")
52
+
53
+ @field_serializer('credentials')
54
+ def serialize_credentials(self, credentials: Credentials, _info):
55
+ return {
56
+ "token": credentials.token.model_dump() if credentials.token is not None else None,
57
+ "scopes": credentials.scopes if credentials.scopes is not None else None
58
+ }
59
+
60
+ @field_serializer('user')
61
+ def serialize_user(self, user: User, _info):
62
+ return {
63
+ "is_authenticated": user.is_authenticated,
64
+ "display_name": user.display_name,
65
+ "identity": user.identity
66
+ }
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: maleo_foundation
3
- Version: 0.3.43
3
+ Version: 0.3.44
4
4
  Summary: Foundation package for Maleo
5
5
  Author-email: Agra Bima Yuda <agra@nexmedis.com>
6
6
  License: MIT
@@ -1,5 +1,5 @@
1
1
  maleo_foundation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- maleo_foundation/authentication.py,sha256=TSszeTEKijy95gdYM_fFGR_VtpPWKDwkP7_AOdoGCA0,1556
2
+ maleo_foundation/authentication.py,sha256=2Fw6rrSnJj7i18UpWovJRKthZyZdq3sLKnkGVYP3wqM,2138
3
3
  maleo_foundation/authorization.py,sha256=HGXCJ47AU1YFMDSmGhrMMmlHnAyghcFZVUiPa1FSvog,283
4
4
  maleo_foundation/constants.py,sha256=LjMIy_Fcr6HLuhIuXs5lCtkyScZXXHOtBMPYx5lwg00,1446
5
5
  maleo_foundation/enums.py,sha256=x6hVz0gvrKRF1ng8lMgVzwfiA_F6Y4vuOU4rBOgtTUg,4758
@@ -133,7 +133,7 @@ maleo_foundation/utils/loaders/credential/__init__.py,sha256=qopTKvcMVoTFwyRijeg
133
133
  maleo_foundation/utils/loaders/credential/google.py,sha256=ZglnLdW3lHmaKER4mwGe5N5ERus-bdsamfpwGmQYPIo,6344
134
134
  maleo_foundation/utils/loaders/key/__init__.py,sha256=hVygcC2ImHc_aVrSrOmyedR8tMUZokWUKCKOSh5ctbo,106
135
135
  maleo_foundation/utils/loaders/key/rsa.py,sha256=gDhyX6iTFtHiluuhFCozaZ3pOLKU2Y9TlrNMK_GVyGU,3796
136
- maleo_foundation-0.3.43.dist-info/METADATA,sha256=CLeev1AHMUMwwKne71UWlImVR2DiHlA6LlzGduE1MXI,3740
137
- maleo_foundation-0.3.43.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
138
- maleo_foundation-0.3.43.dist-info/top_level.txt,sha256=_iBos3F_bhEOdjOnzeiEYSrCucasc810xXtLBXI8cQc,17
139
- maleo_foundation-0.3.43.dist-info/RECORD,,
136
+ maleo_foundation-0.3.44.dist-info/METADATA,sha256=2_3jtAGsVlUYE-_D93ljfnRvx7fWqiY3wIQqZUEA11g,3740
137
+ maleo_foundation-0.3.44.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
138
+ maleo_foundation-0.3.44.dist-info/top_level.txt,sha256=_iBos3F_bhEOdjOnzeiEYSrCucasc810xXtLBXI8cQc,17
139
+ maleo_foundation-0.3.44.dist-info/RECORD,,