workos 1.5.1__py3-none-any.whl → 5.38.0__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.
- workos/__about__.py +1 -1
- workos/__init__.py +3 -7
- workos/_base_client.py +138 -0
- workos/_client_configuration.py +10 -0
- workos/api_keys.py +53 -0
- workos/async_client.py +144 -0
- workos/audit_logs.py +125 -0
- workos/client.py +110 -18
- workos/directory_sync.py +379 -99
- workos/events.py +111 -0
- workos/exceptions.py +53 -26
- workos/fga.py +649 -0
- workos/mfa.py +205 -0
- workos/organization_domains.py +179 -0
- workos/organizations.py +403 -73
- workos/passwordless.py +67 -43
- workos/pipes.py +93 -0
- workos/portal.py +51 -28
- workos/session.py +337 -0
- workos/sso.py +311 -101
- workos/types/__init__.py +4 -0
- workos/types/api_keys/__init__.py +1 -0
- workos/types/api_keys/api_keys.py +20 -0
- workos/types/audit_logs/__init__.py +6 -0
- workos/types/audit_logs/audit_log_event.py +16 -0
- workos/types/audit_logs/audit_log_event_actor.py +12 -0
- workos/types/audit_logs/audit_log_event_context.py +8 -0
- workos/types/audit_logs/audit_log_event_target.py +12 -0
- workos/types/audit_logs/audit_log_export.py +18 -0
- workos/types/audit_logs/audit_log_metadata.py +4 -0
- workos/types/directory_sync/__init__.py +5 -0
- workos/types/directory_sync/directory.py +31 -0
- workos/types/directory_sync/directory_group.py +16 -0
- workos/types/directory_sync/directory_state.py +28 -0
- workos/types/directory_sync/directory_type.py +24 -0
- workos/types/directory_sync/directory_user.py +50 -0
- workos/types/directory_sync/list_filters.py +21 -0
- workos/types/events/__init__.py +13 -0
- workos/types/events/authentication_payload.py +70 -0
- workos/types/events/connection_payload_with_legacy_fields.py +5 -0
- workos/types/events/directory_group_membership_payload.py +9 -0
- workos/types/events/directory_group_with_previous_attributes.py +6 -0
- workos/types/events/directory_payload.py +16 -0
- workos/types/events/directory_payload_with_legacy_fields.py +29 -0
- workos/types/events/directory_user_with_previous_attributes.py +6 -0
- workos/types/events/event.py +324 -0
- workos/types/events/event_model.py +103 -0
- workos/types/events/event_type.py +59 -0
- workos/types/events/list_filters.py +10 -0
- workos/types/events/organization_domain_verification_failed_payload.py +14 -0
- workos/types/events/previous_attributes.py +3 -0
- workos/types/events/session_payload.py +27 -0
- workos/types/feature_flags/__init__.py +3 -0
- workos/types/feature_flags/feature_flag.py +12 -0
- workos/types/feature_flags/list_filters.py +5 -0
- workos/types/fga/__init__.py +5 -0
- workos/types/fga/authorization_resource_types.py +9 -0
- workos/types/fga/authorization_resources.py +10 -0
- workos/types/fga/check.py +51 -0
- workos/types/fga/list_filters.py +24 -0
- workos/types/fga/warnings.py +33 -0
- workos/types/fga/warrant.py +49 -0
- workos/types/list_resource.py +198 -0
- workos/types/metadata.py +4 -0
- workos/types/mfa/__init__.py +5 -0
- workos/types/mfa/authentication_challenge.py +14 -0
- workos/types/mfa/authentication_challenge_verification_response.py +9 -0
- workos/types/mfa/authentication_factor.py +70 -0
- workos/types/mfa/authentication_factor_totp_and_challenge_response.py +10 -0
- workos/types/mfa/enroll_authentication_factor_type.py +8 -0
- workos/types/organization_domains/__init__.py +1 -0
- workos/types/organization_domains/organization_domain.py +18 -0
- workos/types/organizations/__init__.py +6 -0
- workos/types/organizations/domain_data_input.py +7 -0
- workos/types/organizations/list_filters.py +6 -0
- workos/types/organizations/organization.py +13 -0
- workos/types/organizations/organization_common.py +12 -0
- workos/types/passwordless/__init__.py +2 -0
- workos/types/passwordless/passwordless_session.py +12 -0
- workos/types/passwordless/passwordless_session_type.py +3 -0
- workos/types/pipes/__init__.py +6 -0
- workos/types/pipes/pipes.py +34 -0
- workos/types/portal/__init__.py +2 -0
- workos/types/portal/portal_link.py +7 -0
- workos/types/portal/portal_link_intent.py +11 -0
- workos/types/portal/portal_link_intent_options.py +9 -0
- workos/types/roles/__init__.py +0 -0
- workos/types/roles/role.py +27 -0
- workos/types/sso/__init__.py +4 -0
- workos/types/sso/connection.py +70 -0
- workos/types/sso/connection_domain.py +8 -0
- workos/types/sso/profile.py +35 -0
- workos/types/sso/sso_provider_type.py +10 -0
- workos/types/user_management/__init__.py +12 -0
- workos/types/user_management/authenticate_with_common.py +66 -0
- workos/types/user_management/authentication_response.py +53 -0
- workos/types/user_management/email_verification.py +18 -0
- workos/types/user_management/impersonator.py +8 -0
- workos/types/user_management/invitation.py +26 -0
- workos/types/user_management/list_filters.py +29 -0
- workos/types/user_management/magic_auth.py +18 -0
- workos/types/user_management/oauth_tokens.py +21 -0
- workos/types/user_management/organization_membership.py +25 -0
- workos/types/user_management/password_hash_type.py +4 -0
- workos/types/user_management/password_reset.py +18 -0
- workos/types/user_management/screen_hint.py +3 -0
- workos/types/user_management/session.py +79 -0
- workos/types/user_management/user.py +22 -0
- workos/types/user_management/user_management_provider_type.py +11 -0
- workos/types/vault/__init__.py +2 -0
- workos/types/vault/key.py +25 -0
- workos/types/vault/object.py +38 -0
- workos/types/webhooks/__init__.py +0 -0
- workos/types/webhooks/webhook.py +330 -0
- workos/types/webhooks/webhook_model.py +14 -0
- workos/types/webhooks/webhook_payload.py +4 -0
- workos/types/widgets/__init__.py +2 -0
- workos/types/widgets/widget_scope.py +4 -0
- workos/types/widgets/widget_token_response.py +7 -0
- workos/types/workos_model.py +26 -0
- workos/typing/__init__.py +1 -0
- workos/typing/literals.py +32 -0
- workos/typing/sync_or_async.py +5 -0
- workos/typing/untyped_literal.py +37 -0
- workos/typing/webhooks.py +18 -0
- workos/user_management.py +2400 -0
- workos/utils/_base_http_client.py +252 -0
- workos/utils/crypto_provider.py +39 -0
- workos/utils/http_client.py +214 -0
- workos/utils/pagination_order.py +4 -0
- workos/utils/request_helper.py +27 -0
- workos/vault.py +544 -0
- workos/webhooks.py +96 -39
- workos/widgets.py +55 -0
- {workos-1.5.1.dist-info → workos-5.38.0.dist-info}/LICENSE +1 -1
- workos-5.38.0.dist-info/METADATA +107 -0
- workos-5.38.0.dist-info/RECORD +141 -0
- {workos-1.5.1.dist-info → workos-5.38.0.dist-info}/WHEEL +1 -1
- workos/audit_trail.py +0 -172
- workos/resources/base.py +0 -36
- workos/resources/event.py +0 -42
- workos/resources/event_action.py +0 -11
- workos/resources/sso.py +0 -53
- workos/utils/connection_types.py +0 -17
- workos/utils/request.py +0 -95
- workos/utils/validation.py +0 -45
- workos-1.5.1.dist-info/METADATA +0 -77
- workos-1.5.1.dist-info/RECORD +0 -25
- /workos/{resources/__init__.py → py.typed} +0 -0
- {workos-1.5.1.dist-info → workos-5.38.0.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
from typing import Literal, Optional, Union
|
|
2
|
+
|
|
3
|
+
from workos.types.workos_model import WorkOSModel
|
|
4
|
+
from workos.types.mfa.enroll_authentication_factor_type import (
|
|
5
|
+
SmsAuthenticationFactorType,
|
|
6
|
+
TotpAuthenticationFactorType,
|
|
7
|
+
)
|
|
8
|
+
from workos.typing.literals import LiteralOrUntyped
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
AuthenticationFactorType = Literal[
|
|
12
|
+
"generic_otp", SmsAuthenticationFactorType, TotpAuthenticationFactorType
|
|
13
|
+
]
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class TotpFactor(WorkOSModel):
|
|
17
|
+
"""Representation of a TOTP factor when returned in list resources and sessions."""
|
|
18
|
+
|
|
19
|
+
issuer: str
|
|
20
|
+
user: str
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class ExtendedTotpFactor(TotpFactor):
|
|
24
|
+
"""Representation of a TOTP factor when returned when enrolling an authentication factor."""
|
|
25
|
+
|
|
26
|
+
qr_code: str
|
|
27
|
+
secret: str
|
|
28
|
+
uri: str
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class SmsFactor(WorkOSModel):
|
|
32
|
+
phone_number: str
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class AuthenticationFactorBase(WorkOSModel):
|
|
36
|
+
"""Representation of a MFA Authentication Factor Response as returned by WorkOS through the MFA feature."""
|
|
37
|
+
|
|
38
|
+
object: Literal["authentication_factor"]
|
|
39
|
+
id: str
|
|
40
|
+
created_at: str
|
|
41
|
+
updated_at: str
|
|
42
|
+
type: LiteralOrUntyped[AuthenticationFactorType]
|
|
43
|
+
user_id: Optional[str] = None
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
class AuthenticationFactorTotp(AuthenticationFactorBase):
|
|
47
|
+
"""Representation of a MFA Authentication Factor Response as returned by WorkOS through the MFA feature."""
|
|
48
|
+
|
|
49
|
+
type: TotpAuthenticationFactorType
|
|
50
|
+
totp: TotpFactor
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
class AuthenticationFactorTotpExtended(AuthenticationFactorBase):
|
|
54
|
+
"""Representation of a MFA Authentication Factor Response when enrolling an authentication factor."""
|
|
55
|
+
|
|
56
|
+
type: TotpAuthenticationFactorType
|
|
57
|
+
totp: ExtendedTotpFactor
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
class AuthenticationFactorSms(AuthenticationFactorBase):
|
|
61
|
+
"""Representation of a SMS Authentication Factor Response as returned by WorkOS through the MFA feature."""
|
|
62
|
+
|
|
63
|
+
type: SmsAuthenticationFactorType
|
|
64
|
+
sms: SmsFactor
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
AuthenticationFactor = Union[AuthenticationFactorTotp, AuthenticationFactorSms]
|
|
68
|
+
AuthenticationFactorExtended = Union[
|
|
69
|
+
AuthenticationFactorTotpExtended, AuthenticationFactorSms
|
|
70
|
+
]
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
from workos.types.workos_model import WorkOSModel
|
|
2
|
+
from workos.types.mfa.authentication_challenge import AuthenticationChallenge
|
|
3
|
+
from workos.types.mfa.authentication_factor import AuthenticationFactorTotpExtended
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class AuthenticationFactorTotpAndChallengeResponse(WorkOSModel):
|
|
7
|
+
"""Representation of an authentication factor and authentication challenge response as returned by WorkOS through User Management features."""
|
|
8
|
+
|
|
9
|
+
authentication_factor: AuthenticationFactorTotpExtended
|
|
10
|
+
authentication_challenge: AuthenticationChallenge
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .organization_domain import *
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
from typing import Literal, Optional
|
|
2
|
+
from workos.types.workos_model import WorkOSModel
|
|
3
|
+
from workos.typing.literals import LiteralOrUntyped
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class OrganizationDomain(WorkOSModel):
|
|
7
|
+
id: str
|
|
8
|
+
organization_id: str
|
|
9
|
+
object: Literal["organization_domain"]
|
|
10
|
+
domain: str
|
|
11
|
+
state: Optional[
|
|
12
|
+
LiteralOrUntyped[Literal["failed", "pending", "legacy_verified", "verified"]]
|
|
13
|
+
] = None
|
|
14
|
+
verification_strategy: Optional[LiteralOrUntyped[Literal["manual", "dns"]]] = None
|
|
15
|
+
verification_token: Optional[str] = None
|
|
16
|
+
verification_prefix: Optional[str] = None
|
|
17
|
+
created_at: str
|
|
18
|
+
updated_at: str
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
from dataclasses import field
|
|
2
|
+
from typing import Optional, Sequence
|
|
3
|
+
from workos.types.metadata import Metadata
|
|
4
|
+
from workos.types.organizations.organization_common import OrganizationCommon
|
|
5
|
+
from workos.types.organization_domains import OrganizationDomain
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class Organization(OrganizationCommon):
|
|
9
|
+
allow_profiles_outside_organization: bool
|
|
10
|
+
domains: Sequence[OrganizationDomain]
|
|
11
|
+
stripe_customer_id: Optional[str] = None
|
|
12
|
+
external_id: Optional[str] = None
|
|
13
|
+
metadata: Metadata = field(default_factory=dict)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
from typing import Literal, Sequence
|
|
2
|
+
from workos.types.workos_model import WorkOSModel
|
|
3
|
+
from workos.types.organization_domains import OrganizationDomain
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class OrganizationCommon(WorkOSModel):
|
|
7
|
+
id: str
|
|
8
|
+
object: Literal["organization"]
|
|
9
|
+
name: str
|
|
10
|
+
domains: Sequence[OrganizationDomain]
|
|
11
|
+
created_at: str
|
|
12
|
+
updated_at: str
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
from typing import Literal
|
|
2
|
+
from workos.types.workos_model import WorkOSModel
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class PasswordlessSession(WorkOSModel):
|
|
6
|
+
"""Representation of a WorkOS Passwordless Session Response."""
|
|
7
|
+
|
|
8
|
+
object: Literal["passwordless_session"]
|
|
9
|
+
id: str
|
|
10
|
+
email: str
|
|
11
|
+
expires_at: str
|
|
12
|
+
link: str
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
from datetime import datetime
|
|
2
|
+
from typing import Literal, Optional, Sequence, Union
|
|
3
|
+
|
|
4
|
+
from workos.types.workos_model import WorkOSModel
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class AccessToken(WorkOSModel):
|
|
8
|
+
"""Represents an OAuth access token for a third-party provider."""
|
|
9
|
+
|
|
10
|
+
object: Literal["access_token"]
|
|
11
|
+
access_token: str
|
|
12
|
+
expires_at: Optional[datetime] = None
|
|
13
|
+
scopes: Sequence[str]
|
|
14
|
+
missing_scopes: Sequence[str]
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class GetAccessTokenSuccessResponse(WorkOSModel):
|
|
18
|
+
"""Successful response containing the access token."""
|
|
19
|
+
|
|
20
|
+
active: Literal[True]
|
|
21
|
+
access_token: AccessToken
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class GetAccessTokenFailureResponse(WorkOSModel):
|
|
25
|
+
"""Failed response indicating why the token couldn't be retrieved."""
|
|
26
|
+
|
|
27
|
+
active: Literal[False]
|
|
28
|
+
error: Literal["not_installed", "needs_reauthorization"]
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
GetAccessTokenResponse = Union[
|
|
32
|
+
GetAccessTokenSuccessResponse,
|
|
33
|
+
GetAccessTokenFailureResponse,
|
|
34
|
+
]
|
|
File without changes
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
from typing import Literal, Optional, Sequence
|
|
2
|
+
from workos.types.workos_model import WorkOSModel
|
|
3
|
+
|
|
4
|
+
RoleType = Literal["EnvironmentRole", "OrganizationRole"]
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class RoleCommon(WorkOSModel):
|
|
8
|
+
object: Literal["role"]
|
|
9
|
+
slug: str
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class EventRole(RoleCommon):
|
|
13
|
+
permissions: Optional[Sequence[str]] = None
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class Role(RoleCommon):
|
|
17
|
+
id: str
|
|
18
|
+
name: str
|
|
19
|
+
description: Optional[str] = None
|
|
20
|
+
type: RoleType
|
|
21
|
+
created_at: str
|
|
22
|
+
updated_at: str
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class RoleList(WorkOSModel):
|
|
26
|
+
object: Literal["list"]
|
|
27
|
+
data: Sequence[Role]
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
from typing import Literal, Sequence, Optional
|
|
2
|
+
from workos.types.sso.connection_domain import ConnectionDomain
|
|
3
|
+
from workos.types.workos_model import WorkOSModel
|
|
4
|
+
from workos.typing.literals import LiteralOrUntyped
|
|
5
|
+
|
|
6
|
+
ConnectionState = Literal[
|
|
7
|
+
"active", "deleting", "inactive", "requires_type", "validating"
|
|
8
|
+
]
|
|
9
|
+
|
|
10
|
+
ConnectionType = Literal[
|
|
11
|
+
"ADFSSAML",
|
|
12
|
+
"AdpOidc",
|
|
13
|
+
"AppleOAuth",
|
|
14
|
+
"Auth0SAML",
|
|
15
|
+
"AzureSAML",
|
|
16
|
+
"CasSAML",
|
|
17
|
+
"CloudflareSAML",
|
|
18
|
+
"ClassLinkSAML",
|
|
19
|
+
"CyberArkSAML",
|
|
20
|
+
"DuoSAML",
|
|
21
|
+
"GenericOIDC",
|
|
22
|
+
"GenericSAML",
|
|
23
|
+
"GitHubOAuth",
|
|
24
|
+
"GoogleOAuth",
|
|
25
|
+
"GoogleSAML",
|
|
26
|
+
"JumpCloudSAML",
|
|
27
|
+
"KeycloakSAML",
|
|
28
|
+
"LastPassSAML",
|
|
29
|
+
"LoginGovOidc",
|
|
30
|
+
"MagicLink",
|
|
31
|
+
"MicrosoftOAuth",
|
|
32
|
+
"MiniOrangeSAML",
|
|
33
|
+
"NetIqSAML",
|
|
34
|
+
"OktaSAML",
|
|
35
|
+
"OneLoginSAML",
|
|
36
|
+
"OracleSAML",
|
|
37
|
+
"PingFederateSAML",
|
|
38
|
+
"PingOneSAML",
|
|
39
|
+
"RipplingSAML",
|
|
40
|
+
"SalesforceOAuth",
|
|
41
|
+
"SalesforceSAML",
|
|
42
|
+
"ShibbolethGenericSAML",
|
|
43
|
+
"ShibbolethSAML",
|
|
44
|
+
"SimpleSamlPhpSAML",
|
|
45
|
+
"VMwareSAML",
|
|
46
|
+
]
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
class SamlConnectionOptions(WorkOSModel):
|
|
50
|
+
"""Representation of options payload of a Connection Response."""
|
|
51
|
+
|
|
52
|
+
signing_cert: Optional[str]
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
class Connection(WorkOSModel):
|
|
56
|
+
object: Literal["connection"]
|
|
57
|
+
id: str
|
|
58
|
+
organization_id: Optional[str] = None
|
|
59
|
+
connection_type: LiteralOrUntyped[ConnectionType]
|
|
60
|
+
name: str
|
|
61
|
+
state: LiteralOrUntyped[ConnectionState]
|
|
62
|
+
created_at: str
|
|
63
|
+
updated_at: str
|
|
64
|
+
options: Optional[SamlConnectionOptions] = None
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
class ConnectionWithDomains(Connection):
|
|
68
|
+
"""Representation of a Connection Response as returned by WorkOS through the SSO feature."""
|
|
69
|
+
|
|
70
|
+
domains: Sequence[ConnectionDomain]
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
from typing import Any, Literal, Mapping, Optional, Sequence
|
|
2
|
+
from workos.types.sso.connection import ConnectionType
|
|
3
|
+
from workos.types.workos_model import WorkOSModel
|
|
4
|
+
from workos.typing.literals import LiteralOrUntyped
|
|
5
|
+
from typing_extensions import TypedDict
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class ProfileRole(TypedDict):
|
|
9
|
+
slug: str
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class Profile(WorkOSModel):
|
|
13
|
+
"""Representation of a User Profile as returned by WorkOS through the SSO feature."""
|
|
14
|
+
|
|
15
|
+
object: Literal["profile"]
|
|
16
|
+
id: str
|
|
17
|
+
connection_id: str
|
|
18
|
+
connection_type: LiteralOrUntyped[ConnectionType]
|
|
19
|
+
organization_id: Optional[str] = None
|
|
20
|
+
email: str
|
|
21
|
+
first_name: Optional[str] = None
|
|
22
|
+
last_name: Optional[str] = None
|
|
23
|
+
idp_id: str
|
|
24
|
+
role: Optional[ProfileRole] = None
|
|
25
|
+
roles: Optional[Sequence[ProfileRole]] = None
|
|
26
|
+
groups: Optional[Sequence[str]] = None
|
|
27
|
+
custom_attributes: Optional[Mapping[str, Any]] = None
|
|
28
|
+
raw_attributes: Optional[Mapping[str, Any]] = None
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class ProfileAndToken(WorkOSModel):
|
|
32
|
+
"""Representation of a User Profile and Access Token as returned by WorkOS through the SSO feature."""
|
|
33
|
+
|
|
34
|
+
access_token: str
|
|
35
|
+
profile: Profile
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
from .authenticate_with_common import *
|
|
2
|
+
from .authentication_response import *
|
|
3
|
+
from .email_verification import *
|
|
4
|
+
from .impersonator import *
|
|
5
|
+
from .invitation import *
|
|
6
|
+
from .magic_auth import *
|
|
7
|
+
from .organization_membership import *
|
|
8
|
+
from .password_hash_type import *
|
|
9
|
+
from .password_reset import *
|
|
10
|
+
from .user_management_provider_type import *
|
|
11
|
+
from .user import *
|
|
12
|
+
from .session import *
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
from typing import Literal, Union
|
|
2
|
+
from typing_extensions import TypedDict
|
|
3
|
+
from workos.types.user_management.session import SessionConfig
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class AuthenticateWithBaseParameters(TypedDict):
|
|
7
|
+
ip_address: Union[str, None]
|
|
8
|
+
user_agent: Union[str, None]
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class AuthenticateWithPasswordParameters(AuthenticateWithBaseParameters):
|
|
12
|
+
email: str
|
|
13
|
+
password: str
|
|
14
|
+
grant_type: Literal["password"]
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class AuthenticateWithCodeParameters(AuthenticateWithBaseParameters):
|
|
18
|
+
code: str
|
|
19
|
+
code_verifier: Union[str, None]
|
|
20
|
+
grant_type: Literal["authorization_code"]
|
|
21
|
+
session: Union[SessionConfig, None]
|
|
22
|
+
invitation_token: Union[str, None]
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class AuthenticateWithMagicAuthParameters(AuthenticateWithBaseParameters):
|
|
26
|
+
code: str
|
|
27
|
+
email: str
|
|
28
|
+
link_authorization_code: Union[str, None]
|
|
29
|
+
grant_type: Literal["urn:workos:oauth:grant-type:magic-auth:code"]
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class AuthenticateWithEmailVerificationParameters(AuthenticateWithBaseParameters):
|
|
33
|
+
code: str
|
|
34
|
+
pending_authentication_token: str
|
|
35
|
+
grant_type: Literal["urn:workos:oauth:grant-type:email-verification:code"]
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class AuthenticateWithTotpParameters(AuthenticateWithBaseParameters):
|
|
39
|
+
code: str
|
|
40
|
+
authentication_challenge_id: str
|
|
41
|
+
pending_authentication_token: str
|
|
42
|
+
grant_type: Literal["urn:workos:oauth:grant-type:mfa-totp"]
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
class AuthenticateWithOrganizationSelectionParameters(AuthenticateWithBaseParameters):
|
|
46
|
+
organization_id: str
|
|
47
|
+
pending_authentication_token: str
|
|
48
|
+
grant_type: Literal["urn:workos:oauth:grant-type:organization-selection"]
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
class AuthenticateWithRefreshTokenParameters(AuthenticateWithBaseParameters):
|
|
52
|
+
refresh_token: str
|
|
53
|
+
organization_id: Union[str, None]
|
|
54
|
+
grant_type: Literal["refresh_token"]
|
|
55
|
+
session: Union[SessionConfig, None]
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
AuthenticateWithParameters = Union[
|
|
59
|
+
AuthenticateWithPasswordParameters,
|
|
60
|
+
AuthenticateWithCodeParameters,
|
|
61
|
+
AuthenticateWithMagicAuthParameters,
|
|
62
|
+
AuthenticateWithEmailVerificationParameters,
|
|
63
|
+
AuthenticateWithTotpParameters,
|
|
64
|
+
AuthenticateWithOrganizationSelectionParameters,
|
|
65
|
+
AuthenticateWithRefreshTokenParameters,
|
|
66
|
+
]
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
from typing import Literal, Optional, TypeVar
|
|
2
|
+
from workos.types.user_management.impersonator import Impersonator
|
|
3
|
+
from workos.types.user_management.oauth_tokens import OAuthTokens
|
|
4
|
+
from workos.types.user_management.user import User
|
|
5
|
+
from workos.types.workos_model import WorkOSModel
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
AuthenticationMethod = Literal[
|
|
9
|
+
"SSO",
|
|
10
|
+
"Password",
|
|
11
|
+
"Passkey",
|
|
12
|
+
"AppleOAuth",
|
|
13
|
+
"GitHubOAuth",
|
|
14
|
+
"GoogleOAuth",
|
|
15
|
+
"MicrosoftOAuth",
|
|
16
|
+
"SalesforceOAuth",
|
|
17
|
+
"MagicAuth",
|
|
18
|
+
"Impersonation",
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class _AuthenticationResponseBase(WorkOSModel):
|
|
23
|
+
access_token: str
|
|
24
|
+
refresh_token: str
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class AuthenticationResponse(_AuthenticationResponseBase):
|
|
28
|
+
"""Representation of a WorkOS User and Organization ID response."""
|
|
29
|
+
|
|
30
|
+
authentication_method: Optional[AuthenticationMethod] = None
|
|
31
|
+
impersonator: Optional[Impersonator] = None
|
|
32
|
+
organization_id: Optional[str] = None
|
|
33
|
+
user: User
|
|
34
|
+
sealed_session: Optional[str] = None
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
class AuthKitAuthenticationResponse(AuthenticationResponse):
|
|
38
|
+
"""Representation of a WorkOS User and Organization ID response."""
|
|
39
|
+
|
|
40
|
+
impersonator: Optional[Impersonator] = None
|
|
41
|
+
oauth_tokens: Optional[OAuthTokens] = None
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
class RefreshTokenAuthenticationResponse(AuthenticationResponse):
|
|
45
|
+
"""Representation of a WorkOS refresh token authentication response."""
|
|
46
|
+
|
|
47
|
+
pass
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
AuthenticationResponseType = TypeVar(
|
|
51
|
+
"AuthenticationResponseType",
|
|
52
|
+
bound=_AuthenticationResponseBase,
|
|
53
|
+
)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
from typing import Literal
|
|
2
|
+
from workos.types.workos_model import WorkOSModel
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class EmailVerificationCommon(WorkOSModel):
|
|
6
|
+
object: Literal["email_verification"]
|
|
7
|
+
id: str
|
|
8
|
+
user_id: str
|
|
9
|
+
email: str
|
|
10
|
+
expires_at: str
|
|
11
|
+
created_at: str
|
|
12
|
+
updated_at: str
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class EmailVerification(EmailVerificationCommon):
|
|
16
|
+
"""Representation of a WorkOS EmailVerification object."""
|
|
17
|
+
|
|
18
|
+
code: str
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
from typing import Literal, Optional
|
|
2
|
+
from workos.types.workos_model import WorkOSModel
|
|
3
|
+
from workos.typing.literals import LiteralOrUntyped
|
|
4
|
+
|
|
5
|
+
InvitationState = Literal["accepted", "expired", "pending", "revoked"]
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class InvitationCommon(WorkOSModel):
|
|
9
|
+
object: Literal["invitation"]
|
|
10
|
+
id: str
|
|
11
|
+
email: str
|
|
12
|
+
state: LiteralOrUntyped[InvitationState]
|
|
13
|
+
accepted_at: Optional[str] = None
|
|
14
|
+
revoked_at: Optional[str] = None
|
|
15
|
+
expires_at: str
|
|
16
|
+
organization_id: Optional[str] = None
|
|
17
|
+
inviter_user_id: Optional[str] = None
|
|
18
|
+
created_at: str
|
|
19
|
+
updated_at: str
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class Invitation(InvitationCommon):
|
|
23
|
+
"""Representation of a WorkOS Invitation as returned."""
|
|
24
|
+
|
|
25
|
+
token: str
|
|
26
|
+
accept_invitation_url: str
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
from typing import Optional, Sequence
|
|
2
|
+
from workos.types.list_resource import ListArgs
|
|
3
|
+
from workos.types.user_management.organization_membership import (
|
|
4
|
+
OrganizationMembershipStatus,
|
|
5
|
+
)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class UsersListFilters(ListArgs, total=False):
|
|
9
|
+
email: Optional[str]
|
|
10
|
+
organization_id: Optional[str]
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class InvitationsListFilters(ListArgs, total=False):
|
|
14
|
+
email: Optional[str]
|
|
15
|
+
organization_id: Optional[str]
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class OrganizationMembershipsListFilters(ListArgs, total=False):
|
|
19
|
+
user_id: Optional[str]
|
|
20
|
+
organization_id: Optional[str]
|
|
21
|
+
statuses: Optional[Sequence[OrganizationMembershipStatus]]
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class AuthenticationFactorsListFilters(ListArgs, total=False):
|
|
25
|
+
user_id: str
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class SessionsListFilters(ListArgs, total=False):
|
|
29
|
+
user_id: str
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
from typing import Literal
|
|
2
|
+
from workos.types.workos_model import WorkOSModel
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class MagicAuthCommon(WorkOSModel):
|
|
6
|
+
object: Literal["magic_auth"]
|
|
7
|
+
id: str
|
|
8
|
+
user_id: str
|
|
9
|
+
email: str
|
|
10
|
+
expires_at: str
|
|
11
|
+
created_at: str
|
|
12
|
+
updated_at: str
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class MagicAuth(MagicAuthCommon):
|
|
16
|
+
"""Representation of a WorkOS MagicAuth object."""
|
|
17
|
+
|
|
18
|
+
code: str
|