feat: add canonical identity administration
This commit is contained in:
@@ -1,6 +1,19 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from pydantic import BaseModel
|
||||
from datetime import datetime
|
||||
from typing import Any, Literal
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
|
||||
class IdentityAccountLinkItem(BaseModel):
|
||||
id: str
|
||||
identity_id: str
|
||||
account_id: str
|
||||
is_primary: bool
|
||||
source: str
|
||||
created_at: datetime
|
||||
updated_at: datetime
|
||||
|
||||
|
||||
class IdentityItem(BaseModel):
|
||||
@@ -10,8 +23,59 @@ class IdentityItem(BaseModel):
|
||||
source: str
|
||||
primary_account_id: str | None = None
|
||||
account_ids: list[str]
|
||||
status: str
|
||||
account_links: list[IdentityAccountLinkItem] = Field(default_factory=list)
|
||||
status: Literal["active", "inactive"]
|
||||
is_active: bool
|
||||
settings: dict[str, Any] = Field(default_factory=dict)
|
||||
management_scope: Literal["system"] = "system"
|
||||
created_at: datetime
|
||||
updated_at: datetime
|
||||
|
||||
|
||||
class IdentityListResponse(BaseModel):
|
||||
identities: list[IdentityItem]
|
||||
management_scope: Literal["system"] = "system"
|
||||
tenant_context_id: str | None = None
|
||||
|
||||
|
||||
class IdentityCreateRequest(BaseModel):
|
||||
model_config = ConfigDict(extra="forbid")
|
||||
|
||||
display_name: str | None = Field(default=None, max_length=255)
|
||||
external_subject: str | None = Field(default=None, max_length=255)
|
||||
source: str = Field(default="local", min_length=1, max_length=50)
|
||||
is_active: bool = True
|
||||
settings: dict[str, Any] = Field(default_factory=dict)
|
||||
|
||||
|
||||
class IdentityUpdateRequest(BaseModel):
|
||||
model_config = ConfigDict(extra="forbid")
|
||||
|
||||
display_name: str | None = Field(default=None, max_length=255)
|
||||
external_subject: str | None = Field(default=None, max_length=255)
|
||||
source: str | None = Field(default=None, min_length=1, max_length=50)
|
||||
is_active: bool | None = None
|
||||
settings: dict[str, Any] | None = None
|
||||
reason: str | None = Field(default=None, max_length=500)
|
||||
|
||||
|
||||
class IdentityLifecycleRequest(BaseModel):
|
||||
model_config = ConfigDict(extra="forbid")
|
||||
|
||||
reason: str | None = Field(default=None, max_length=500)
|
||||
|
||||
|
||||
class IdentityAccountLinkCreateRequest(BaseModel):
|
||||
model_config = ConfigDict(extra="forbid")
|
||||
|
||||
account_id: str = Field(min_length=1, max_length=36)
|
||||
source: str = Field(default="local", min_length=1, max_length=50)
|
||||
make_primary: bool = False
|
||||
reason: str | None = Field(default=None, max_length=500)
|
||||
|
||||
|
||||
class IdentityAccountLinkUpdateRequest(BaseModel):
|
||||
model_config = ConfigDict(extra="forbid")
|
||||
|
||||
is_primary: bool
|
||||
reason: str | None = Field(default=None, max_length=500)
|
||||
|
||||
Reference in New Issue
Block a user