Skip to content

Latest commit

 

History

History
247 lines (169 loc) · 29.5 KB

File metadata and controls

247 lines (169 loc) · 29.5 KB

SamlConnectionsSDK

(saml_connections)

Overview

Available Operations

  • list - Get a list of SAML Connections for an instance
  • create - Create a SAML Connection
  • get - Retrieve a SAML Connection by ID
  • update - Update a SAML Connection
  • delete - Delete a SAML Connection

list

Returns the list of SAML Connections for an instance. Results can be paginated using the optional limit and offset query parameters. The SAML Connections are ordered by descending creation date and the most recent will be returned first.

Example Usage

from clerk_backend_api import Clerk

with Clerk(
    bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
) as clerk:

    res = clerk.saml_connections.list(limit=20, offset=10)

    assert res is not None

    # Handle response
    print(res)

Parameters

Parameter Type Required Description Example
limit Optional[int] Applies a limit to the number of results returned.
Can be used for paginating the results together with offset.
20
offset Optional[int] Skip the first offset results when paginating.
Needs to be an integer greater or equal to zero.
To be used in conjunction with limit.
10
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.SAMLConnections

Errors

Error Type Status Code Content Type
models.ClerkErrors 402, 403, 422 application/json
models.SDKError 4XX, 5XX */*

create

Create a new SAML Connection.

Example Usage

import clerk_backend_api
from clerk_backend_api import Clerk

with Clerk(
    bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
) as clerk:

    res = clerk.saml_connections.create(name="My SAML Connection", domain="example.org", provider=clerk_backend_api.Provider.SAML_CUSTOM, idp_entity_id="http://idp.example.org/", idp_sso_url="http://idp.example.org/sso", idp_certificate="MIIDdzCCAl+gAwIBAgIJAKcyBaiiz+DT...", idp_metadata_url="http://idp.example.org/metadata.xml", idp_metadata="<EntityDescriptor ...", attribute_mapping={
        "user_id": "nameid",
        "email_address": "mail",
        "first_name": "givenName",
        "last_name": "surname",
    })

    assert res is not None

    # Handle response
    print(res)

Parameters

Parameter Type Required Description Example
name str ✔️ The name to use as a label for this SAML Connection My SAML Connection
domain str ✔️ The domain of your organization. Sign in flows using an email with this domain, will use this SAML Connection. example.org
provider models.Provider ✔️ The IdP provider of the connection. saml_custom
idp_entity_id OptionalNullable[str] The Entity ID as provided by the IdP http://idp.example.org/
idp_sso_url OptionalNullable[str] The Single-Sign On URL as provided by the IdP http://idp.example.org/sso
idp_certificate OptionalNullable[str] The X.509 certificate as provided by the IdP MIIDdzCCAl+gAwIBAgIJAKcyBaiiz+DT...
idp_metadata_url OptionalNullable[str] The URL which serves the IdP metadata. If present, it takes priority over the corresponding individual properties http://idp.example.org/metadata.xml
idp_metadata OptionalNullable[str] The XML content of the IdP metadata file. If present, it takes priority over the corresponding individual properties <EntityDescriptor ...
attribute_mapping OptionalNullable[models.CreateSAMLConnectionAttributeMapping] Define the attribute name mapping between Identity Provider and Clerk's user properties
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.SchemasSAMLConnection

Errors

Error Type Status Code Content Type
models.ClerkErrors 402, 403, 422 application/json
models.SDKError 4XX, 5XX */*

get

Fetches the SAML Connection whose ID matches the provided saml_connection_id in the path.

Example Usage

from clerk_backend_api import Clerk

with Clerk(
    bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
) as clerk:

    res = clerk.saml_connections.get(saml_connection_id="saml_conn_123")

    assert res is not None

    # Handle response
    print(res)

Parameters

Parameter Type Required Description Example
saml_connection_id str ✔️ The ID of the SAML Connection saml_conn_123
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.SchemasSAMLConnection

Errors

Error Type Status Code Content Type
models.ClerkErrors 402, 403, 404 application/json
models.SDKError 4XX, 5XX */*

update

Updates the SAML Connection whose ID matches the provided id in the path.

Example Usage

from clerk_backend_api import Clerk

with Clerk(
    bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
) as clerk:

    res = clerk.saml_connections.update(saml_connection_id="saml_conn_123_update", name="Example SAML Connection", domain="example.com", idp_entity_id="entity_123", idp_sso_url="https://idp.example.com/sso", idp_certificate="MIIDBTCCAe2gAwIBAgIQ...", idp_metadata_url="https://idp.example.com/metadata", idp_metadata="<EntityDescriptor>...</EntityDescriptor>", attribute_mapping={
        "user_id": "id123",
        "email_address": "[email protected]",
        "first_name": "Jane",
        "last_name": "Doe",
    }, active=True, sync_user_attributes=False, allow_subdomains=True, allow_idp_initiated=False, disable_additional_identifications=False)

    assert res is not None

    # Handle response
    print(res)

Parameters

Parameter Type Required Description Example
saml_connection_id str ✔️ The ID of the SAML Connection to update saml_conn_123_update
name OptionalNullable[str] The name of the new SAML Connection Example SAML Connection
domain OptionalNullable[str] The domain to use for the new SAML Connection example.com
idp_entity_id OptionalNullable[str] The entity id as provided by the IdP entity_123
idp_sso_url OptionalNullable[str] The SSO url as provided by the IdP https://idp.example.com/sso
idp_certificate OptionalNullable[str] The x509 certificated as provided by the IdP MIIDBTCCAe2gAwIBAgIQ...
idp_metadata_url OptionalNullable[str] The URL which serves the IdP metadata. If present, it takes priority over the corresponding individual properties and replaces them https://idp.example.com/metadata
idp_metadata OptionalNullable[str] The XML content of the IdP metadata file. If present, it takes priority over the corresponding individual properties ...
attribute_mapping OptionalNullable[models.UpdateSAMLConnectionAttributeMapping] Define the atrtibute name mapping between Identity Provider and Clerk's user properties
active OptionalNullable[bool] Activate or de-activate the SAML Connection true
sync_user_attributes OptionalNullable[bool] Controls whether to update the user's attributes in each sign-in false
allow_subdomains OptionalNullable[bool] Allow users with an email address subdomain to use this connection in order to authenticate true
allow_idp_initiated OptionalNullable[bool] Enable or deactivate IdP-initiated flows false
disable_additional_identifications OptionalNullable[bool] Enable or deactivate additional identifications
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.SchemasSAMLConnection

Errors

Error Type Status Code Content Type
models.ClerkErrors 402, 403, 404, 422 application/json
models.SDKError 4XX, 5XX */*

delete

Deletes the SAML Connection whose ID matches the provided id in the path.

Example Usage

from clerk_backend_api import Clerk

with Clerk(
    bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
) as clerk:

    res = clerk.saml_connections.delete(saml_connection_id="saml_conn_123_delete")

    assert res is not None

    # Handle response
    print(res)

Parameters

Parameter Type Required Description Example
saml_connection_id str ✔️ The ID of the SAML Connection to delete saml_conn_123_delete
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.DeletedObject

Errors

Error Type Status Code Content Type
models.ClerkErrors 402, 403, 404 application/json
models.SDKError 4XX, 5XX */*