111 lines
2.5 KiB
Python
111 lines
2.5 KiB
Python
from datetime import datetime
|
|
from typing import Any
|
|
|
|
from ninja import Schema
|
|
|
|
|
|
class PublicIdentityProviderOut(Schema):
|
|
slug: str
|
|
name: str
|
|
button_label: str
|
|
provider_type: str
|
|
|
|
|
|
class IdentityProviderOut(Schema):
|
|
id: int
|
|
slug: str
|
|
name: str
|
|
provider_type: str
|
|
enabled: bool
|
|
button_label: str
|
|
issuer: str
|
|
metadata_url: str
|
|
client_id: str
|
|
credential_set: bool
|
|
credential_masked: str
|
|
scopes: list[str]
|
|
claim_mappings: dict[str, str]
|
|
configuration: dict[str, Any]
|
|
auto_create_users: bool
|
|
sync_profile: bool
|
|
sync_groups: bool
|
|
identity_count: int
|
|
group_mapping_count: int
|
|
created_at: datetime
|
|
updated_at: datetime
|
|
|
|
|
|
class IdentityProviderCreateIn(Schema):
|
|
slug: str
|
|
name: str
|
|
provider_type: str = "oidc"
|
|
enabled: bool = False
|
|
button_label: str = ""
|
|
issuer: str = ""
|
|
metadata_url: str = ""
|
|
client_id: str = ""
|
|
credential: str = ""
|
|
scopes: list[str] = ["openid", "profile", "email"]
|
|
claim_mappings: dict[str, str] = {}
|
|
configuration: dict[str, Any] = {}
|
|
auto_create_users: bool = True
|
|
sync_profile: bool = True
|
|
sync_groups: bool = True
|
|
|
|
|
|
class IdentityProviderUpdateIn(Schema):
|
|
name: str | None = None
|
|
enabled: bool | None = None
|
|
button_label: str | None = None
|
|
issuer: str | None = None
|
|
metadata_url: str | None = None
|
|
client_id: str | None = None
|
|
credential: str | None = None
|
|
scopes: list[str] | None = None
|
|
claim_mappings: dict[str, str] | None = None
|
|
configuration: dict[str, Any] | None = None
|
|
auto_create_users: bool | None = None
|
|
sync_profile: bool | None = None
|
|
sync_groups: bool | None = None
|
|
|
|
|
|
class EnterpriseGroupMappingOut(Schema):
|
|
id: int
|
|
provider_id: int
|
|
external_group: str
|
|
user_group_id: int
|
|
user_group_name: str
|
|
user_group_code: str
|
|
created_at: datetime
|
|
|
|
|
|
class EnterpriseGroupMappingIn(Schema):
|
|
external_group: str
|
|
user_group_id: int
|
|
|
|
|
|
class DirectoryRecordIn(Schema):
|
|
subject: str
|
|
username: str = ""
|
|
email: str = ""
|
|
display_name: str = ""
|
|
active: bool = True
|
|
groups: list[str] = []
|
|
|
|
|
|
class DirectorySyncIn(Schema):
|
|
records: list[DirectoryRecordIn]
|
|
|
|
|
|
class DirectorySyncRunOut(Schema):
|
|
id: int
|
|
provider_id: int
|
|
status: str
|
|
total_count: int
|
|
created_count: int
|
|
updated_count: int
|
|
failed_count: int
|
|
errors: list[dict[str, Any]]
|
|
started_at: datetime
|
|
finished_at: datetime | None = None
|