Skip to content

SAML Clients

Use SAML clients when an application or service provider expects SAML 2.0 instead of OpenID Connect. This is common for legacy enterprise applications and commercial service providers such as Salesforce, Jira, or other platforms that rely on SAML metadata, signed assertions, and SSO endpoints.

API Reference

KindAPI GroupTerraformCRD Explorer
Clientsamlclient.keycloak.crossplane.io/v1alpha1keycloak_saml_clientView CRD Schema
ClientScopesamlclient.keycloak.crossplane.io/v1alpha1keycloak_saml_client_scopeView CRD Schema
ClientDefaultScopessamlclient.keycloak.crossplane.io/v1alpha1keycloak_saml_client_default_scopesView CRD Schema

Working YAML examples

SAML Client

Use a SAML client to represent the service provider that trusts Keycloak for SSO.

apiVersion: samlclient.keycloak.crossplane.io/v1alpha1
kind: Client
metadata:
  name: saml-client
spec:
  deletionPolicy: Delete
  forProvider:
    clientId: saml-client-id
    includeAuthnStatement: true
    name: saml-client
    realmIdRef:
      name: "dev"
      policy:
        resolve: Always
    signAssertions: true
    signDocuments: false
    signingCertificateSecretRef:
      name: rsa-key
      namespace: dev
      key: cert
    signingPrivateKeySecretRef:
      name: saml-cliet-cert
      namespace: dev
      key: priv
  providerConfigRef:
    name: "keycloak-provider-config"

SAML Client Scope

Use a SAML client scope to define reusable mapper and assertion behavior that can be shared across clients.

apiVersion: samlclient.keycloak.crossplane.io/v1alpha1
kind: ClientScope
metadata:
  name: saml-client-scopes
spec:
  deletionPolicy: Delete
  forProvider:
    description: This scope will map a user's group memberships to SAML assertion
    guiOrder: 1
    name: groups
    realmIdRef:
      name: "dev"
      policy:
        resolve: Always
  providerConfigRef:
    name: "keycloak-provider-config"

SAML Client Default Scopes

Use default scopes to attach one or more SAML client scopes automatically to a client.

apiVersion: samlclient.keycloak.crossplane.io/v1alpha1
kind: ClientDefaultScopes
metadata:
  name: saml-client-default-scopes
spec:
  deletionPolicy: Delete
  forProvider:
    clientIdRef:
      name: saml-client
      policy:
        resolve: Always
    defaultScopes:
      - groups
    realmIdRef:
      name: "dev"
      policy:
        resolve: Always
  providerConfigRef:
    name: "keycloak-provider-config"

Key fields

Client

FieldWhy it matters
clientIdSAML entity ID for the service provider.
realmIdRefSelects the realm that owns the client.
includeAuthnStatementAdds an AuthnStatement to issued assertions when required by the application.
signAssertionsSigns SAML assertions sent to the service provider.
signDocumentsSigns the SAML document envelope when the integration requires it.
signingCertificateSecretRefSupplies the public certificate used for signing.
signingPrivateKeySecretRefSupplies the private key used for signing.

ClientScope

FieldWhy it matters
nameScope name referenced by SAML clients.
descriptionExplains the purpose of the scope in Keycloak.
guiOrderControls display order in the Keycloak admin UI.
realmIdRefSelects the realm that owns the scope.

ClientDefaultScopes

FieldWhy it matters
clientIdRefResolves the SAML client that should receive the scopes.
defaultScopesLists the scope names that are applied automatically.
realmIdRefEnsures the client and scopes are resolved in the right realm.

Related Resources

  • Clients — Compare SAML clients with OpenID Connect clients.
  • Protocol Mappers — Add mappers that shape SAML assertions and attributes.
  • Realms — Create the realm that owns the client and scopes.