Skip to content

Commit

Permalink
Fix sso profile resource (#314)
Browse files Browse the repository at this point in the history
* Default groups to None

* Set defaults for all optional types and use Optional

* Update mfa with default None

* Add defaults to authentication payload
  • Loading branch information
tribble authored Aug 5, 2024
1 parent f518871 commit d70843f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions workos/resources/mfa.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ class AuthenticationFactorTotp(AuthenticationFactorBase):
"""Representation of a MFA Authentication Factor Response as returned by WorkOS through the MFA feature."""

type: TotpAuthenticationFactorType
totp: Union[TotpFactor, ExtendedTotpFactor, None]
totp: Union[TotpFactor, ExtendedTotpFactor, None] = None


class AuthenticationFactorSms(AuthenticationFactorBase):
"""Representation of a SMS Authentication Factor Response as returned by WorkOS through the MFA feature."""

type: SmsAuthenticationFactorType
sms: Union[SmsFactor, None]
sms: Union[SmsFactor, None] = None


AuthenticationFactor = Union[AuthenticationFactorTotp, AuthenticationFactorSms]
Expand Down
10 changes: 5 additions & 5 deletions workos/resources/sso.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Literal, Sequence, Union
from typing import Literal, Optional, Sequence, Union
from workos.resources.workos_model import WorkOSModel
from workos.types.sso.connection import Connection, ConnectionType
from workos.typing.literals import LiteralOrUntyped
Expand All @@ -11,12 +11,12 @@ class Profile(WorkOSModel):
id: str
connection_id: str
connection_type: LiteralOrUntyped[ConnectionType]
organization_id: Union[str, None]
organization_id: Optional[str] = None
email: str
first_name: Union[str, None]
last_name: Union[str, None]
first_name: Optional[str] = None
last_name: Optional[str] = None
idp_id: str
groups: Union[Sequence[str], None]
groups: Optional[Sequence[str]] = None
raw_attributes: dict


Expand Down
8 changes: 4 additions & 4 deletions workos/types/events/authentication_payload.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from typing import Literal, Union
from typing import Literal, Optional
from workos.resources.workos_model import WorkOSModel


class AuthenticationResultCommon(WorkOSModel):
ip_address: Union[str, None]
user_agent: Union[str, None]
ip_address: Optional[str] = None
user_agent: Optional[str] = None
email: str
created_at: str

Expand Down Expand Up @@ -58,4 +58,4 @@ class AuthenticationPasswordSucceededPayload(AuthenticationResultSucceeded):

class AuthenticationSsoSucceededPayload(AuthenticationResultSucceeded):
type: Literal["sso"]
user_id: Union[str, None]
user_id: Optional[str] = None

0 comments on commit d70843f

Please sign in to comment.