| 1 |
|
| 2 |
|
| 3 |
import typing |
| 4 |
|
| 5 |
import pydantic |
| 6 |
import typing_extensions |
| 7 |
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel |
| 8 |
from ..core.serialization import FieldMetadata |
| 9 |
from .user_id import UserId |
| 10 |
from .user_profile_data import UserProfileData |
| 11 |
|
| 12 |
|
| 13 |
class UserIdentity(UniversalBaseModel): |
| 14 |
connection: str = pydantic.Field() |
| 15 |
""" |
| 16 |
Connection name of this identity. |
| 17 |
""" |
| 18 |
|
| 19 |
user_id: UserId = pydantic.Field() |
| 20 |
""" |
| 21 |
user_id of this identity. |
| 22 |
""" |
| 23 |
|
| 24 |
provider: str = pydantic.Field() |
| 25 |
""" |
| 26 |
Type of identity provider. |
| 27 |
""" |
| 28 |
|
| 29 |
profile_data: typing_extensions.Annotated[ |
| 30 |
typing.Optional[UserProfileData], FieldMetadata(alias="profileData"), pydantic.Field(alias="profileData") |
| 31 |
] = None |
| 32 |
is_social: typing_extensions.Annotated[ |
| 33 |
typing.Optional[bool], |
| 34 |
FieldMetadata(alias="isSocial"), |
| 35 |
pydantic.Field( |
| 36 |
alias="isSocial", description="Whether the identity provider is a social provider (true) or not (false)." |
| 37 |
), |
| 38 |
] = None |
| 39 |
""" |
| 40 |
Whether the identity provider is a social provider (true) or not (false). |
| 41 |
""" |
| 42 |
|
| 43 |
access_token: typing.Optional[str] = pydantic.Field(default=None) |
| 44 |
""" |
| 45 |
IDP access token returned if scope `read:user_idp_tokens` is defined. |
| 46 |
""" |
| 47 |
|
| 48 |
access_token_secret: typing.Optional[str] = pydantic.Field(default=None) |
| 49 |
""" |
| 50 |
IDP access token secret returned only if `scope read:user_idp_tokens` is defined. |
| 51 |
""" |
| 52 |
|
| 53 |
refresh_token: typing.Optional[str] = pydantic.Field(default=None) |
| 54 |
""" |
| 55 |
IDP refresh token returned only if scope `read:user_idp_tokens` is defined. |
| 56 |
""" |
| 57 |
|
| 58 |
if IS_PYDANTIC_V2: |
| 59 |
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) |
| 60 |
else: |
| 61 |
|
| 62 |
class Config: |
| 63 |
frozen = True |
| 64 |
smart_union = True |
| 65 |
extra = pydantic.Extra.allow |