Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions titan/resources/authentication_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class AuthenticationMethods(ParseableEnum):
SAML = "SAML"
OAUTH = "OAUTH"
KEYPAIR = "KEYPAIR"
PROGRAMMATIC = "PROGRAMMATIC"


class MFAEnrollment(ParseableEnum):
Expand All @@ -26,6 +27,7 @@ class ClientTypes(ParseableEnum):
SNOWFLAKE_UI = "SNOWFLAKE_UI"
DRIVERS = "DRIVERS"
SNOWSQL = "SNOWSQL"
PROGRAMMATIC_CLIENT = "PROGRAMMATIC_CLIENT"


@dataclass(unsafe_hash=True)
Expand All @@ -52,8 +54,11 @@ def __post_init__(self):
AuthenticationMethods.ALL,
AuthenticationMethods.SAML,
AuthenticationMethods.PASSWORD,
AuthenticationMethods.PROGRAMMATIC
):
raise ValueError("MFA authentication methods must be either 'ALL', 'SAML', or 'PASSWORD'")
raise ValueError(
"MFA authentication methods must be either 'ALL', 'SAML', 'PROGRAMMATIC', or 'PASSWORD'"
)
if (
len(self.mfa_authentication_methods) == 1
and self.mfa_authentication_methods[0] == AuthenticationMethods.ALL
Expand Down Expand Up @@ -90,12 +95,12 @@ class AuthenticationPolicy(NamedResource, Resource):
```python
authentication_policy = AuthenticationPolicy(
name="some_authentication_policy",
authentication_methods=["PASSWORD", "SAML"],
authentication_methods=["PASSWORD", "SAML", "PROGRAMMATIC"],
mfa_authentication_methods=["PASSWORD"],
mfa_enrollment="REQUIRED",
client_types=["SNOWFLAKE_UI"],
client_types=["SNOWFLAKE_UI", "PROGRAMMATIC_CLIENT"],
security_integrations=["ALL"],
comment="Policy for secure authentication."
comment="Policy for secure authentication including PAT support."
)
```

Expand All @@ -106,12 +111,13 @@ class AuthenticationPolicy(NamedResource, Resource):
- name: some_authentication_policy
authentication_methods:
- PASSWORD
- SAML
- PROGRAMMATIC
mfa_authentication_methods:
- PASSWORD
mfa_enrollment: REQUIRED
client_types:
- SNOWFLAKE_UI
- PROGRAMMATIC_CLIENT
security_integrations:
- ALL
comment: Policy for secure authentication.
Expand Down