Skip to content

Clients

Use a Client when an application or service needs Keycloak to authenticate users with OpenID Connect. This is the resource for web apps, SPAs, backend services, service accounts, and federated workloads.

API Reference

KindAPI GroupTerraform ResourceCRD Explorer
Clientopenidclient.keycloak.crossplane.io/v1alpha1keycloak_openid_clientView CRD Schema

Examples

Confidential client with authorization

apiVersion: openidclient.keycloak.crossplane.io/v1alpha1
kind: Client
metadata:
  name: test
spec:
  deletionPolicy: Delete
  forProvider:
    realmIdRef:
      name: "dev"
      policy:
        resolve: Always
    accessType: "CONFIDENTIAL"
    clientId: "test"
    fullScopeAllowed: false
    serviceAccountsEnabled: true
    authorization:
      - policyEnforcementMode: "PERMISSIVE"
  providerConfigRef:
    name: "keycloak-provider-config"

Managing a built-in client without deleting it

apiVersion: openidclient.keycloak.crossplane.io/v1alpha1
kind: Client
metadata:
  name: account
spec:
  managementPolicies: ["Create", "Update", "Observe"]
  forProvider:
    realmIdRef:
      name: "dev"
      policy:
        resolve: Always
    accessType: "CONFIDENTIAL"
    clientId: "account"
  providerConfigRef:
    name: "keycloak-provider-config"

Managing another built-in client (account-console)

apiVersion: openidclient.keycloak.crossplane.io/v1alpha1
kind: Client
metadata:
  name: account-console
spec:
  managementPolicies: [Observe, Update]
  deletionPolicy: Orphan
  forProvider:
    realmIdRef:
      name: "dev"
      policy:
        resolve: Always
    accessType: "PUBLIC"
    clientId: "account-console"
  providerConfigRef:
    name: "keycloak-provider-config"

Service account client

apiVersion: openidclient.keycloak.crossplane.io/v1alpha1
kind: Client
metadata:
  name: service-acc-1
spec:
  deletionPolicy: Delete
  forProvider:
    realmIdRef:
      name: "dev"
      policy:
        resolve: Always
    accessType: "CONFIDENTIAL"
    clientId: "service-acc-1"
    serviceAccountsEnabled: true
  providerConfigRef:
    name: "keycloak-provider-config"

Kubernetes federated JWT client

apiVersion: openidclient.keycloak.crossplane.io/v1alpha1
kind: Client
metadata:
  name: k8s-federated-client
spec:
  deletionPolicy: Delete
  forProvider:
    accessType: CONFIDENTIAL
    clientAuthenticatorType: federated-jwt
    clientId: k8s-federated-client
    enabled: true
    name: k8s-federated-client
    realmIdRef:
      name: "orgs"
      policy:
        resolve: Always
    serviceAccountsEnabled: true
    standardFlowEnabled: false
    extraConfig:
      federated.idp: k8s-federated
      federated.sub: system:serviceaccount:default:k8s-federated-test-sa
  providerConfigRef:
    name: "keycloak-provider-config"

Key Fields

FieldDescription
accessTypeClient type. Use CONFIDENTIAL for server-side apps, PUBLIC for browser or native apps, and BEARER-ONLY for APIs that only validate tokens.
clientIdUnique client identifier in the realm.
serviceAccountsEnabledEnables a service account so the client can use client credentials flows.
fullScopeAllowedControls whether the client automatically receives all realm and client scopes.
authorizationEnables and configures Keycloak Authorization Services for the client.
standardFlowEnabledEnables the authorization code flow.
implicitFlowEnabledEnables the implicit flow for legacy browser-based integrations.
directAccessGrantsEnabledEnables direct username/password token grants.
clientAuthenticatorTypeSelects how the client authenticates, such as standard secret-based auth or federated-jwt.

Related Resources