# This file was auto-generated by Fern from our API Definition.

import datetime as dt
import typing

import pydantic
import typing_extensions
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from ..core.serialization import FieldMetadata
from .event_stream_cloud_event_connection_created_object_2_options_assertion_decryption_settings import (
    EventStreamCloudEventConnectionCreatedObject2OptionsAssertionDecryptionSettings,
)
from .event_stream_cloud_event_connection_created_object_2_options_digest_algorithm_enum import (
    EventStreamCloudEventConnectionCreatedObject2OptionsDigestAlgorithmEnum,
)
from .event_stream_cloud_event_connection_created_object_2_options_fields_map import (
    EventStreamCloudEventConnectionCreatedObject2OptionsFieldsMap,
)
from .event_stream_cloud_event_connection_created_object_2_options_idpinitiated import (
    EventStreamCloudEventConnectionCreatedObject2OptionsIdpinitiated,
)
from .event_stream_cloud_event_connection_created_object_2_options_protocol_binding_enum import (
    EventStreamCloudEventConnectionCreatedObject2OptionsProtocolBindingEnum,
)
from .event_stream_cloud_event_connection_created_object_2_options_set_user_root_attributes_enum import (
    EventStreamCloudEventConnectionCreatedObject2OptionsSetUserRootAttributesEnum,
)
from .event_stream_cloud_event_connection_created_object_2_options_signature_algorithm_enum import (
    EventStreamCloudEventConnectionCreatedObject2OptionsSignatureAlgorithmEnum,
)
from .event_stream_cloud_event_connection_created_object_2_options_subject import (
    EventStreamCloudEventConnectionCreatedObject2OptionsSubject,
)
from .event_stream_cloud_event_connection_created_object_2_options_upstream_params import (
    EventStreamCloudEventConnectionCreatedObject2OptionsUpstreamParams,
)


class EventStreamCloudEventConnectionCreatedObject2Options(UniversalBaseModel):
    """
    Options for the 'samlp' connection
    """

    assertion_decryption_settings: typing.Optional[
        EventStreamCloudEventConnectionCreatedObject2OptionsAssertionDecryptionSettings
    ] = None
    cert: typing.Optional[str] = pydantic.Field(default=None)
    """
    X.509 signing certificate from the identity provider in .der format. Used to validate signatures in SAML Responses and Assertions. This is an alternative to signingCert and is kept for backward compatibility. Prefer using signingCert instead.
    """

    cert_rollover_notification: typing.Optional[dt.datetime] = pydantic.Field(default=None)
    """
    Timestamp of the last certificate expiring soon notification.
    """

    digest_algorithm: typing_extensions.Annotated[
        typing.Optional[EventStreamCloudEventConnectionCreatedObject2OptionsDigestAlgorithmEnum],
        FieldMetadata(alias="digestAlgorithm"),
        pydantic.Field(alias="digestAlgorithm"),
    ] = None
    domain_aliases: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
    """
    Domain aliases for the connection
    """

    entity_id: typing_extensions.Annotated[
        typing.Optional[str],
        FieldMetadata(alias="entityId"),
        pydantic.Field(
            alias="entityId",
            description="The entity identifier (Issuer) for the SAML Service Provider. When not provided, defaults to 'urn:auth0:{tenant}:{connection}'. This value is included in SAML AuthnRequest messages sent to the identity provider.",
        ),
    ] = None
    """
    The entity identifier (Issuer) for the SAML Service Provider. When not provided, defaults to 'urn:auth0:{tenant}:{connection}'. This value is included in SAML AuthnRequest messages sent to the identity provider.
    """

    expires: typing.Optional[dt.datetime] = pydantic.Field(default=None)
    """
    ISO 8601 formatted datetime indicating when the identity provider's signing certificate expires.
    """

    icon_url: typing.Optional[str] = pydantic.Field(default=None)
    """
    URL for the connection icon displayed in Auth0 login pages. Accepts HTTPS URLs. Used for visual branding in authentication flows.
    """

    idpinitiated: typing.Optional[EventStreamCloudEventConnectionCreatedObject2OptionsIdpinitiated] = None
    non_persistent_attrs: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
    """
    An array of user fields that should not be stored in the Auth0 database (https://auth0.com/docs/security/data-security/denylist)
    """

    protocol_binding: typing_extensions.Annotated[
        typing.Optional[EventStreamCloudEventConnectionCreatedObject2OptionsProtocolBindingEnum],
        FieldMetadata(alias="protocolBinding"),
        pydantic.Field(alias="protocolBinding"),
    ] = None
    set_user_root_attributes: typing.Optional[
        EventStreamCloudEventConnectionCreatedObject2OptionsSetUserRootAttributesEnum
    ] = None
    signature_algorithm: typing_extensions.Annotated[
        typing.Optional[EventStreamCloudEventConnectionCreatedObject2OptionsSignatureAlgorithmEnum],
        FieldMetadata(alias="signatureAlgorithm"),
        pydantic.Field(alias="signatureAlgorithm"),
    ] = None
    sign_in_endpoint: typing_extensions.Annotated[
        typing.Optional[str],
        FieldMetadata(alias="signInEndpoint"),
        pydantic.Field(
            alias="signInEndpoint",
            description="Identity provider's SAML SingleSignOnService endpoint URL where Auth0 sends SAML authentication requests. This is the primary login URL for the SAML connection. Required unless using metadataUrl or metadataXml.",
        ),
    ] = None
    """
    Identity provider's SAML SingleSignOnService endpoint URL where Auth0 sends SAML authentication requests. This is the primary login URL for the SAML connection. Required unless using metadataUrl or metadataXml.
    """

    signing_cert: typing_extensions.Annotated[
        typing.Optional[str],
        FieldMetadata(alias="signingCert"),
        pydantic.Field(
            alias="signingCert",
            description="Base64-encoded X.509 certificate from the identity provider used to validate signatures in SAML responses and assertions. The certificate is decoded and used for cryptographic signature verification.",
        ),
    ] = None
    """
    Base64-encoded X.509 certificate from the identity provider used to validate signatures in SAML responses and assertions. The certificate is decoded and used for cryptographic signature verification.
    """

    sign_saml_request: typing_extensions.Annotated[
        typing.Optional[bool],
        FieldMetadata(alias="signSAMLRequest"),
        pydantic.Field(
            alias="signSAMLRequest",
            description="When true, Auth0 signs SAML authentication requests using the connection's signing key. The signature includes the request's digest and is validated by the identity provider. Defaults to false (unsigned requests).",
        ),
    ] = None
    """
    When true, Auth0 signs SAML authentication requests using the connection's signing key. The signature includes the request's digest and is validated by the identity provider. Defaults to false (unsigned requests).
    """

    subject: typing.Optional[EventStreamCloudEventConnectionCreatedObject2OptionsSubject] = None
    tenant_domain: typing.Optional[str] = pydantic.Field(default=None)
    """
    For SAML connections, the tenant domain used to construct the login endpoint URL. Can be a string for single-tenant or an array of strings for multi-tenant validation.
    """

    thumbprints: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
    """
    SHA-1 thumbprints (fingerprints) of the identity provider's signing certificates. Automatically computed from signingCert during connection creation. Each thumbprint must be a 40-character hexadecimal string.
    """

    upstream_params: typing.Optional[EventStreamCloudEventConnectionCreatedObject2OptionsUpstreamParams] = None
    debug: typing.Optional[bool] = pydantic.Field(default=None)
    """
    When true, enables detailed SAML debugging by issuing 'w' (warning) events in tenant logs containing SAML request/response details. WARNING: Potentially exposes sensitive user information (PII, credentials) and should only be enabled temporarily for debugging purposes.
    """

    deflate: typing.Optional[bool] = pydantic.Field(default=None)
    """
    When true, enables DEFLATE compression for SAML requests sent via HTTP-Redirect binding.
    """

    destination_url: typing_extensions.Annotated[
        typing.Optional[str],
        FieldMetadata(alias="destinationUrl"),
        pydantic.Field(
            alias="destinationUrl",
            description="The URL where Auth0 will send SAML authentication requests (the Identity Provider's SSO URL). Must be a valid HTTPS URL.",
        ),
    ] = None
    """
    The URL where Auth0 will send SAML authentication requests (the Identity Provider's SSO URL). Must be a valid HTTPS URL.
    """

    disable_signout: typing_extensions.Annotated[
        typing.Optional[bool],
        FieldMetadata(alias="disableSignout"),
        pydantic.Field(
            alias="disableSignout",
            description="When true, disables sending SAML logout requests (SingleLogoutService) to the identity provider during user sign-out. The user will be logged out of Auth0 but will remain logged into the identity provider. Defaults to false (federated logout enabled).",
        ),
    ] = None
    """
    When true, disables sending SAML logout requests (SingleLogoutService) to the identity provider during user sign-out. The user will be logged out of Auth0 but will remain logged into the identity provider. Defaults to false (federated logout enabled).
    """

    fields_map: typing_extensions.Annotated[
        typing.Optional[EventStreamCloudEventConnectionCreatedObject2OptionsFieldsMap],
        FieldMetadata(alias="fieldsMap"),
        pydantic.Field(alias="fieldsMap"),
    ] = None
    global_token_revocation_jwt_iss: typing.Optional[str] = pydantic.Field(default=None)
    """
    Expected 'iss' (Issuer) claim value for JWT tokens in Global Token Revocation requests from the identity provider. When configured, Auth0 validates the JWT issuer matches this value before processing token revocation. Must be used together with global_token_revocation_jwt_sub.
    """

    global_token_revocation_jwt_sub: typing.Optional[str] = pydantic.Field(default=None)
    """
    Expected 'sub' (Subject) claim value for JWT tokens in Global Token Revocation requests from the identity provider. When configured, Auth0 validates the JWT subject matches this value before processing token revocation. Must be used together with global_token_revocation_jwt_iss.
    """

    metadata_url: typing_extensions.Annotated[
        typing.Optional[str],
        FieldMetadata(alias="metadataUrl"),
        pydantic.Field(
            alias="metadataUrl",
            description="HTTPS URL to the identity provider's SAML metadata document. When provided, Auth0 automatically fetches and parses the metadata to extract signInEndpoint, signOutEndpoint, signingCert, signSAMLRequest, and protocolBinding. Use metadataUrl OR metadataXml, not both.",
        ),
    ] = None
    """
    HTTPS URL to the identity provider's SAML metadata document. When provided, Auth0 automatically fetches and parses the metadata to extract signInEndpoint, signOutEndpoint, signingCert, signSAMLRequest, and protocolBinding. Use metadataUrl OR metadataXml, not both.
    """

    recipient_url: typing_extensions.Annotated[
        typing.Optional[str],
        FieldMetadata(alias="recipientUrl"),
        pydantic.Field(
            alias="recipientUrl",
            description="The URL where Auth0 will send SAML authentication requests (the Identity Provider's SSO URL). Must be a valid HTTPS URL.",
        ),
    ] = None
    """
    The URL where Auth0 will send SAML authentication requests (the Identity Provider's SSO URL). Must be a valid HTTPS URL.
    """

    request_template: typing_extensions.Annotated[
        typing.Optional[str],
        FieldMetadata(alias="requestTemplate"),
        pydantic.Field(
            alias="requestTemplate",
            description="Custom XML template for SAML authentication requests. Supports variable substitution using @@variableName@@ syntax. When not provided, uses default SAML AuthnRequest template. See https://auth0.com/docs/authenticate/protocols/saml/saml-sso-integrations/configure-auth0-saml-service-provider#customize-the-request-template",
        ),
    ] = None
    """
    Custom XML template for SAML authentication requests. Supports variable substitution using @@variableName@@ syntax. When not provided, uses default SAML AuthnRequest template. See https://auth0.com/docs/authenticate/protocols/saml/saml-sso-integrations/configure-auth0-saml-service-provider#customize-the-request-template
    """

    sign_out_endpoint: typing_extensions.Annotated[
        typing.Optional[str],
        FieldMetadata(alias="signOutEndpoint"),
        pydantic.Field(
            alias="signOutEndpoint",
            description="Identity provider's SAML SingleLogoutService endpoint URL where Auth0 sends logout requests for federated sign-out. When not provided, defaults to signInEndpoint. Only used if disableSignout is false.",
        ),
    ] = None
    """
    Identity provider's SAML SingleLogoutService endpoint URL where Auth0 sends logout requests for federated sign-out. When not provided, defaults to signInEndpoint. Only used if disableSignout is false.
    """

    user_id_attribute: typing.Optional[str] = pydantic.Field(default=None)
    """
    Custom SAML assertion attribute to use as the unique user identifier. When provided, this attribute is prepended to the default user_id mapping list with highest priority. Accepts a string (single SAML attribute name).
    """

    if IS_PYDANTIC_V2:
        model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True)  # type: ignore # Pydantic v2
    else:

        class Config:
            frozen = True
            smart_union = True
            extra = pydantic.Extra.allow
