Keycloak
Connect a separately-hosted Keycloak instance as an external SAML identity provider for Safeguard.
Keycloak
Use this to connect your own, separately-hosted Keycloak instance as an external IdP — distinct from the internal Keycloak Safeguard's auth service uses as its broker.
Example values
The tenant-specific values (the sg_ab12cde parts) show the shape only — Safeguard displays your real ACS URL and SP Entity ID in the Add Provider dialog after you click Save. This table makes it unambiguous which value goes on which side.
In Keycloak — the SAML app / SP details (you enter these at the IdP):
| Field | Example value |
|---|---|
| ACS URL (Keycloak calls this the Assertion Consumer Service POST Binding URL) | https://api.safeguard.sh/auth/idp/realms/sg_ab12cde/broker/keycloak/endpoint |
| SP Entity ID / Audience | https://api.safeguard.sh/auth/idp/realms/sg_ab12cde |
| Name ID format | EmailAddress |
email attribute | the signed-in user's email (via a SAML Attribute mapper named email on the client) |
In Safeguard — Add Provider → SAML 2.0 (you copy these from the IdP):
| Field | Example value |
|---|---|
| Alias | keycloak |
| Display Name | Sign in with Keycloak |
| SSO Service URL | https://<keycloak-host>/realms/<realm>/protocol/saml |
| Entity ID | https://<keycloak-host>/realms/<realm> |
| X.509 Certificate | the PEM block below |
-----BEGIN CERTIFICATE-----
MIIDdDCCAlygAwIBAgIGAX...(full cert from your IdP)...P3B/k0SolrFYPo
-----END CERTIFICATE------ In your organization's Keycloak admin console, select your realm, then go to Clients → Create client → SAML.
- Set Client ID to the SP Entity ID Safeguard shows after Save (this is the SP Entity ID), and set the Assertion Consumer Service POST Binding URL to the ACS URL Safeguard shows after Save.
- Under Realm Settings → General, copy the realm's SAML 2.0 endpoint and issuer, and export the realm's signing certificate.
- Set Name ID format to Email under the client's Advanced settings.
- Add a SAML Attribute mapper on the client with SAML attribute name
emailmapped to the user's email attribute — separate from the Name ID mapper above. - In Safeguard, click Add Provider → SAML 2.0 → Keycloak, and enter the endpoint, issuer (Entity ID), and certificate.
- Assign the client's role/group mappers to the users who should have access.
- Click Test in Safeguard to confirm.
Common errors: an "invalid_redirect_uri" error from Keycloak means the Callback URL wasn't added to the client's Valid Redirect URIs exactly as shown.