# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***

import warnings
import pulumi
import pulumi.runtime
from typing import Union
from .. import utilities, tables


class Client(pulumi.CustomResource):
    assertion_consumer_post_url: pulumi.Output[str]
    assertion_consumer_redirect_url: pulumi.Output[str]
    base_url: pulumi.Output[str]
    client_id: pulumi.Output[str]
    client_signature_required: pulumi.Output[bool]
    description: pulumi.Output[str]
    enabled: pulumi.Output[bool]
    encrypt_assertions: pulumi.Output[bool]
    encryption_certificate: pulumi.Output[str]
    force_name_id_format: pulumi.Output[bool]
    force_post_binding: pulumi.Output[bool]
    front_channel_logout: pulumi.Output[bool]
    full_scope_allowed: pulumi.Output[bool]
    idp_initiated_sso_relay_state: pulumi.Output[str]
    idp_initiated_sso_url_name: pulumi.Output[str]
    include_authn_statement: pulumi.Output[bool]
    logout_service_post_binding_url: pulumi.Output[str]
    logout_service_redirect_binding_url: pulumi.Output[str]
    master_saml_processing_url: pulumi.Output[str]
    name: pulumi.Output[str]
    name_id_format: pulumi.Output[str]
    realm_id: pulumi.Output[str]
    root_url: pulumi.Output[str]
    sign_assertions: pulumi.Output[bool]
    sign_documents: pulumi.Output[bool]
    signature_algorithm: pulumi.Output[str]
    signing_certificate: pulumi.Output[str]
    signing_private_key: pulumi.Output[str]
    valid_redirect_uris: pulumi.Output[list]
    def __init__(__self__, resource_name, opts=None, assertion_consumer_post_url=None, assertion_consumer_redirect_url=None, base_url=None, client_id=None, client_signature_required=None, description=None, enabled=None, encrypt_assertions=None, encryption_certificate=None, force_name_id_format=None, force_post_binding=None, front_channel_logout=None, full_scope_allowed=None, idp_initiated_sso_relay_state=None, idp_initiated_sso_url_name=None, include_authn_statement=None, logout_service_post_binding_url=None, logout_service_redirect_binding_url=None, master_saml_processing_url=None, name=None, name_id_format=None, realm_id=None, root_url=None, sign_assertions=None, sign_documents=None, signature_algorithm=None, signing_certificate=None, signing_private_key=None, valid_redirect_uris=None, __props__=None, __name__=None, __opts__=None):
        """
        ## # saml.Client

        Allows for creating and managing Keycloak clients that use the SAML protocol.

        Clients are entities that can use Keycloak for user authentication. Typically,
        clients are applications that redirect users to Keycloak for authentication
        in order to take advantage of Keycloak's user sessions for SSO.

        ### Example Usage

        ```python
        import pulumi
        import pulumi_keycloak as keycloak

        realm = keycloak.Realm("realm",
            enabled=True,
            realm="my-realm")
        saml_client = keycloak.saml.Client("samlClient",
            client_id="test-saml-client",
            include_authn_statement=True,
            realm_id=realm.id,
            sign_assertions=True,
            sign_documents=False,
            signing_certificate=(lambda path: open(path).read())("saml-cert.pem"),
            signing_private_key=(lambda path: open(path).read())("saml-key.pem"))
        ```

        ### Argument Reference

        The following arguments are supported:

        - `realm_id` - (Required) The realm this client is attached to.
        - `client_id` - (Required) The unique ID of this client, referenced in the URI during authentication and in issued tokens.
        - `name` - (Optional) The display name of this client in the GUI.
        - `enabled` - (Optional) When false, this client will not be able to initiate a login or obtain access tokens. Defaults to `true`.
        - `description` - (Optional) The description of this client in the GUI.
        - `include_authn_statement` - (Optional) When `true`, an `AuthnStatement` will be included in the SAML response.
        - `sign_documents` - (Optional) When `true`, the SAML document will be signed by Keycloak using the realm's private key.
        - `sign_assertions` - (Optional) When `true`, the SAML assertions will be signed by Keycloak using the realm's private key, and embedded within the SAML XML Auth response.
        - `client_signature_required` - (Optional) When `true`, Keycloak will expect that documents originating from a client will be signed using the certificate and/or key configured via `signing_certificate` and `signing_private_key`.
        - `force_post_binding` - (Optional) When `true`, Keycloak will always respond to an authentication request via the SAML POST Binding.
        - `front_channel_logout` - (Optional) When `true`, this client will require a browser redirect in order to perform a logout.
        - `name_id_format` - (Optional) Sets the Name ID format for the subject.
        - `root_url` - (Optional) When specified, this value is prepended to all relative URLs.
        - `valid_redirect_uris` - (Optional) When specified, Keycloak will use this list to validate given Assertion Consumer URLs specified in the authentication request.
        - `base_url` - (Optional) When specified, this URL will be used whenever Keycloak needs to link to this client.
        - `master_saml_processing_url` - (Optional) When specified, this URL will be used for all SAML requests.
        - `signing_certificate` - (Optional) If documents or assertions from the client are signed, this certificate will be used to verify the signature.
        - `signing_private_key` - (Optional) If documents or assertions from the client are signed, this private key will be used to verify the signature.
        - `idp_initiated_sso_url_name` - (Optional) URL fragment name to reference client when you want to do IDP Initiated SSO.
        - `idp_initiated_sso_relay_state` - (Optional) Relay state you want to send with SAML request when you want to do IDP Initiated SSO.
        - `assertion_consumer_post_url` - (Optional) SAML POST Binding URL for the client's assertion consumer service (login responses).
        - `assertion_consumer_redirect_url` - (Optional) SAML Redirect Binding URL for the client's assertion consumer service (login responses).
        - `logout_service_post_binding_url` - (Optional) SAML POST Binding URL for the client's single logout service.
        - `logout_service_redirect_binding_url` - (Optional) SAML Redirect Binding URL for the client's single logout service.
        - `full_scope_allowed` - (Optional) - Allow to include all roles mappings in the access token

        :param str resource_name: The name of the resource.
        :param pulumi.ResourceOptions opts: Options for the resource.
        """
        if __name__ is not None:
            warnings.warn("explicit use of __name__ is deprecated", DeprecationWarning)
            resource_name = __name__
        if __opts__ is not None:
            warnings.warn("explicit use of __opts__ is deprecated, use 'opts' instead", DeprecationWarning)
            opts = __opts__
        if opts is None:
            opts = pulumi.ResourceOptions()
        if not isinstance(opts, pulumi.ResourceOptions):
            raise TypeError('Expected resource options to be a ResourceOptions instance')
        if opts.version is None:
            opts.version = utilities.get_version()
        if opts.id is None:
            if __props__ is not None:
                raise TypeError('__props__ is only valid when passed in combination with a valid opts.id to get an existing resource')
            __props__ = dict()

            __props__['assertion_consumer_post_url'] = assertion_consumer_post_url
            __props__['assertion_consumer_redirect_url'] = assertion_consumer_redirect_url
            __props__['base_url'] = base_url
            if client_id is None:
                raise TypeError("Missing required property 'client_id'")
            __props__['client_id'] = client_id
            __props__['client_signature_required'] = client_signature_required
            __props__['description'] = description
            __props__['enabled'] = enabled
            __props__['encrypt_assertions'] = encrypt_assertions
            __props__['encryption_certificate'] = encryption_certificate
            __props__['force_name_id_format'] = force_name_id_format
            __props__['force_post_binding'] = force_post_binding
            __props__['front_channel_logout'] = front_channel_logout
            __props__['full_scope_allowed'] = full_scope_allowed
            __props__['idp_initiated_sso_relay_state'] = idp_initiated_sso_relay_state
            __props__['idp_initiated_sso_url_name'] = idp_initiated_sso_url_name
            __props__['include_authn_statement'] = include_authn_statement
            __props__['logout_service_post_binding_url'] = logout_service_post_binding_url
            __props__['logout_service_redirect_binding_url'] = logout_service_redirect_binding_url
            __props__['master_saml_processing_url'] = master_saml_processing_url
            __props__['name'] = name
            __props__['name_id_format'] = name_id_format
            if realm_id is None:
                raise TypeError("Missing required property 'realm_id'")
            __props__['realm_id'] = realm_id
            __props__['root_url'] = root_url
            __props__['sign_assertions'] = sign_assertions
            __props__['sign_documents'] = sign_documents
            __props__['signature_algorithm'] = signature_algorithm
            __props__['signing_certificate'] = signing_certificate
            __props__['signing_private_key'] = signing_private_key
            __props__['valid_redirect_uris'] = valid_redirect_uris
        super(Client, __self__).__init__(
            'keycloak:saml/client:Client',
            resource_name,
            __props__,
            opts)

    @staticmethod
    def get(resource_name, id, opts=None, assertion_consumer_post_url=None, assertion_consumer_redirect_url=None, base_url=None, client_id=None, client_signature_required=None, description=None, enabled=None, encrypt_assertions=None, encryption_certificate=None, force_name_id_format=None, force_post_binding=None, front_channel_logout=None, full_scope_allowed=None, idp_initiated_sso_relay_state=None, idp_initiated_sso_url_name=None, include_authn_statement=None, logout_service_post_binding_url=None, logout_service_redirect_binding_url=None, master_saml_processing_url=None, name=None, name_id_format=None, realm_id=None, root_url=None, sign_assertions=None, sign_documents=None, signature_algorithm=None, signing_certificate=None, signing_private_key=None, valid_redirect_uris=None):
        """
        Get an existing Client resource's state with the given name, id, and optional extra
        properties used to qualify the lookup.

        :param str resource_name: The unique name of the resulting resource.
        :param str id: The unique provider ID of the resource to lookup.
        :param pulumi.ResourceOptions opts: Options for the resource.
        """
        opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))

        __props__ = dict()

        __props__["assertion_consumer_post_url"] = assertion_consumer_post_url
        __props__["assertion_consumer_redirect_url"] = assertion_consumer_redirect_url
        __props__["base_url"] = base_url
        __props__["client_id"] = client_id
        __props__["client_signature_required"] = client_signature_required
        __props__["description"] = description
        __props__["enabled"] = enabled
        __props__["encrypt_assertions"] = encrypt_assertions
        __props__["encryption_certificate"] = encryption_certificate
        __props__["force_name_id_format"] = force_name_id_format
        __props__["force_post_binding"] = force_post_binding
        __props__["front_channel_logout"] = front_channel_logout
        __props__["full_scope_allowed"] = full_scope_allowed
        __props__["idp_initiated_sso_relay_state"] = idp_initiated_sso_relay_state
        __props__["idp_initiated_sso_url_name"] = idp_initiated_sso_url_name
        __props__["include_authn_statement"] = include_authn_statement
        __props__["logout_service_post_binding_url"] = logout_service_post_binding_url
        __props__["logout_service_redirect_binding_url"] = logout_service_redirect_binding_url
        __props__["master_saml_processing_url"] = master_saml_processing_url
        __props__["name"] = name
        __props__["name_id_format"] = name_id_format
        __props__["realm_id"] = realm_id
        __props__["root_url"] = root_url
        __props__["sign_assertions"] = sign_assertions
        __props__["sign_documents"] = sign_documents
        __props__["signature_algorithm"] = signature_algorithm
        __props__["signing_certificate"] = signing_certificate
        __props__["signing_private_key"] = signing_private_key
        __props__["valid_redirect_uris"] = valid_redirect_uris
        return Client(resource_name, opts=opts, __props__=__props__)

    def translate_output_property(self, prop):
        return tables._CAMEL_TO_SNAKE_CASE_TABLE.get(prop) or prop

    def translate_input_property(self, prop):
        return tables._SNAKE_TO_CAMEL_CASE_TABLE.get(prop) or prop
