(saml_connections)
- 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
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.
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, organization_id=[
"<id>",
"<id>",
"<id>",
])
assert res is not None
# Handle response
print(res)
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 |
organization_id |
List[str] | ➖ | Returns SAML connections that have an associated organization ID to the given organizations. For each organization id, the + and - can beprepended to the id, which denote whether the respective organization should be included or excluded from the result set. Accepts up to 100 organization ids. |
|
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Error Type | Status Code | Content Type |
---|---|---|
models.ClerkErrors | 402, 403, 422 | application/json |
models.SDKError | 4XX, 5XX | */* |
Create a new SAML Connection.
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(request={
"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 ...",
"organization_id": "<id>",
"attribute_mapping": {
"user_id": "nameid",
"email_address": "mail",
"first_name": "givenName",
"last_name": "surname",
},
})
assert res is not None
# Handle response
print(res)
Parameter | Type | Required | Description |
---|---|---|---|
request |
models.CreateSAMLConnectionRequestBody | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Error Type | Status Code | Content Type |
---|---|---|
models.ClerkErrors | 402, 403, 404, 422 | application/json |
models.SDKError | 4XX, 5XX | */* |
Fetches the SAML Connection whose ID matches the provided saml_connection_id
in the path.
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)
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. |
Error Type | Status Code | Content Type |
---|---|---|
models.ClerkErrors | 402, 403, 404 | application/json |
models.SDKError | 4XX, 5XX | */* |
Updates the SAML Connection whose ID matches the provided id
in the path.
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>", organization_id="<id>", 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)
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 | ... |
organization_id |
OptionalNullable[str] | ➖ | The ID of the organization to which users of this SAML Connection will be added | |
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. |
Error Type | Status Code | Content Type |
---|---|---|
models.ClerkErrors | 402, 403, 404, 422 | application/json |
models.SDKError | 4XX, 5XX | */* |
Deletes the SAML Connection whose ID matches the provided id
in the path.
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)
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. |
Error Type | Status Code | Content Type |
---|---|---|
models.ClerkErrors | 402, 403, 404 | application/json |
models.SDKError | 4XX, 5XX | */* |