Keycloak – SSO & Connector Permissions
Reference Environment: Keycloak Administration Console (Quarkus runtime, Keycloak 24.x–26.x as of late 2026).
Note for administrators: Since Keycloak 19+, the administration console runs on the modern Quarkus-based UI (replacing the legacy WildFly administration console). Navigation paths, dedicated client scopes, protocol mappers, PKCE enforcement settings, and standard OIDC discovery endpoints (/realms/<realm-name>/.well-known/openid-configuration) described in this guide reflect this modern administration UI. If your organization operates Red Hat build of Keycloak (RHBK), the configuration steps and settings are functionally identical.
This guide provides a comprehensive, step-by-step walkthrough for administrators to set up Single Sign-On (SSO) with Keycloak for FSI Server, secure the integration using OpenID Connect (OIDC) with PKCE (S256) and confidential client authentication, and manage fine-grained access to different Source Connectors on FSI Server.
It covers architecture considerations, realm isolation, client configuration, PKCE enforcement, protocol mappers for token claims, user federation (such as Active Directory / LDAP synchronization), identity brokering, and security hardening.
Realm Architecture: Master Realm vs. Dedicated Application Realm
Keycloak organizes users, credentials, roles, and clients into Realms. A realm manages a distinct set of users and applications, providing complete logical isolation:
| Feature | Master Realm | Dedicated Application Realm (e.g., fsi or corporate) |
|---|---|---|
| URL Pattern | https://<keycloak-domain>/realms/master | https://<keycloak-domain>/realms/<realm-name> |
| Primary Purpose | Keycloak system administration, super-admin accounts, and realm provisioning. | Isolating application users, groups, identity providers, and client configurations. |
| Recommendation | Never use for FSI Server. Reserved exclusively for Keycloak cluster management. | Recommended (Production Standard): Create a dedicated realm (e.g., fsi or your corporate realm). |
| OIDC Discovery Issuer URL | https://<keycloak-domain>/realms/master | https://<keycloak-domain>/realms/<realm-name> |
| User & Session Isolation | Global Keycloak admins only. | Dedicated user directory, custom session timeouts, and branded login theme. |
In the following steps, all configuration actions are performed inside your dedicated application realm (e.g., fsi).
Identity Directory Models: Local Groups vs. LDAP/AD Federation vs. Identity Brokering
Keycloak provides versatile options for managing directory identities and assigning group permissions:
| Capability | Keycloak Local Directory | LDAP / Active Directory Federation | Identity Brokering (Upstream IdP) |
|---|---|---|---|
| OIDC Single Sign-On (FSI Server) | ✅ Supported | ✅ Supported | ✅ Supported |
| Connector Access Control | ✅ Local Keycloak Groups | ✅ Synced via group-ldap-mapper | ✅ Mapped from upstream IdP claims |
| Group Membership Management | Manual assignment in Keycloak | ✅ Automated periodic / on-demand sync | ✅ Synchronized at login time |
| Client Authentication (BFF) | ✅ Confidential Client (Secret + PKCE) | ✅ Confidential Client (Secret + PKCE) | ✅ Confidential Client (Secret + PKCE) |
| Token Group Filtering | ✅ Dedicated Client Scope | ✅ Dedicated Client Scope | ✅ Dedicated Client Scope |
| Multi-Factor Authentication (MFA) | ✅ Built-in (OTP / WebAuthn / Passkeys) | ✅ Built-in or delegated to AD | ✅ Delegated to upstream IdP |
| Back-Channel Single Logout (SLO) | ✅ Supported | ✅ Supported | ✅ Supported (if upstream supports SLO) |
| Token Path Customization | ✅ Group Name or Full Path | ✅ Group Name or Full Path | ✅ Group Name or Full Path |
Architecture & Data Flow
On FSI Server, digital assets are organized into Source Connectors (such as local storage directories, SAN/NAS shares, or cloud buckets). Access to each connector is governed by FSI Server Groups.
The following diagram illustrates how user attributes in Keycloak map to security groups, pass through the OIDC authorization code flow with PKCE (S256), and resolve to connector permissions on FSI Server:
Scenario Overview:
| FSI Connector | Purpose | Keycloak Group | Local Keycloak Setup | LDAP / Active Directory Setup | FSI Permission |
|---|---|---|---|---|---|
marketing-assets | Campaign images, graphics | fsi-marketing | Assigned in Keycloak group manager | Synced from CN=FSI-Marketing,OU=Groups,DC=... | Read, Write, Upload (rw) |
product-catalog | E-Commerce product photos | fsi-products | Assigned in Keycloak group manager | Synced from CN=FSI-Products,OU=Groups,DC=... | Read Only / Download (r) |
internal-archive | Confidential company archive | fsi-archive | Assigned with enforced MFA execution | Synced from CN=FSI-Archive,OU=Groups,DC=... | Read Only (r) |
| All Connectors | Full server administration | fsi-administrators | Assigned with WebAuthn/Passkey & OTP | Synced from CN=FSI-Admins,OU=Groups,DC=... | Administrator (Full access) |
Keycloak Administration Console Configuration
Step 1: Create or Select the Application Realm
- Log in to the Keycloak Administration Console (e.g.,
https://<keycloak-domain>/admin/). - In the left sidebar:
- Keycloak 25 / 26+: Click Manage realms at the top of the left sidebar, then click Create realm.
- Keycloak 24 and earlier: Open the realm dropdown menu at the top of the left sidebar and click Create realm.
- Enter the Realm name:
fsi(note: realm names in Keycloak URLs are case-sensitive). - Ensure Enabled is switched to ON.
- Click Create.
Client not found. Prevention)Whenever you open /admin/ or reload the console, Keycloak may default back to the master realm.
Before continuing with Steps 2–7, verify in the top-left corner of the left sidebar that your application realm (fsi, not master) is currently active.
If you accidentally create the client in master while issuerUrl in settings.yml points to /realms/fsi (or vice versa), Keycloak will reject every login attempt with:
We are sorry... Client not found.
Keycloak automatically exposes its standard OIDC discovery configuration under:
https://<keycloak-domain>/realms/<realm-name>/.well-known/openid-configuration
FSI Server uses this endpoint to resolve authorization, token, JWKS, and logout URLs dynamically.
Step 2: Create Groups for Connectors
With your application realm (fsi) selected, navigate in the left menu to:
👉 Groups → Create group
- Create the groups corresponding to your connector permissions:
fsi-marketingfsi-productsfsi-archivefsi-administrators
- Click Create for each group.
Keycloak allows creating nested group structures (e.g., /fsi/marketing). By default, FSI Server expects clean group names matching your groupMapping keys. Keep your connector groups at the root level (or configure the protocol mapper as described in Step 7).
Step 3: Register and Configure the Client
- Confirm you are inside the
fsirealm, then navigate in the left menu to: 👉 Clients → Create client - General settings:
- Client type:
OpenID Connect - Client ID:
fsi-server(Important: Enter exact lowercasefsi-server. This exact string is the OIDCclient_id—do not confuse it with the display Name!) - Name:
FSI Server(Display name shown on consent/account screens) - Description:
FSI Server Media Platform Single Sign-On - Click Next.
- Client type:
- Capability config:
- Client authentication: ON (Mandatory: Configures Keycloak as a Confidential Client requiring a Client Secret).
- Authorization: OFF.
- Authentication flow:
- ☑ Standard flow (Authorization Code Flow)
- ☐ Direct access grants (Uncheck unless Resource Owner Password Credentials / ROPC is explicitly required)
- ☐ Implicit flow (Leave unchecked)
- ☐ Service accounts roles (Leave unchecked unless programmatic backend tokens are used)
- Click Next.
- Login settings:
- Root URL:
https://<fsi-domain> - Home URL:
https://<fsi-domain>/fsi/interface/ - Valid redirect URIs:
https://<fsi-domain>/fsi/interface/(Example:https://fsi.example.com/fsi/interface/– Ensure the trailing slash/is included!) - Valid post logout redirect URIs:
https://<fsi-domain>/fsi/interface/ - Web origins:
+(or explicitlyhttps://<fsi-domain>)
- Root URL:
- Click Save.
Client not found. Prevention)Unlike Microsoft Entra ID (which generates a random UUID as the clientId), Keycloak uses the human-readable Client ID string you entered (fsi-server) as the OIDC client_id.
- Do NOT copy the UUID from your browser's address bar (
/admin/master/console/#/fsi/clients/<uuid>/settings) intosettings.yml—that UUID is only Keycloak's internal database key. - Do NOT use the display Name (
FSI Server) insettings.ymlif your Client ID isfsi-server. Keycloak'sclient_idlookup is strictly case-sensitive. Any mismatch results inWe are sorry... Client not found.
Step 4: Configure Back-Channel Logout
To ensure that logging out from Keycloak or terminating an SSO session immediately invalidates the user's active session on FSI Server, configure Back-Channel Logout:
- In the client configuration of
fsi-server, stay on the Settings tab and scroll down to the Logout settings section (directly below Login settings). - Configure the following fields:
- Frontchannel logout: OFF (disabled).
- Backchannel logout URL: Enter the FSI Server logout endpoint:
https://<fsi-domain>/fsi/service/oidc/logout - Backchannel logout session required: ON (enabled).
- Backchannel logout revoke offline sessions: OFF.
- Click Save.
When a session is revoked or the user logs out from Keycloak, Keycloak sends a signed HTTP POST request with a JWT logout_token to /fsi/service/oidc/logout. FSI Server's backend validates the signature, extracts the user/session identifier (sid / sub), and invalidates all corresponding Tomcat sessions immediately.
Step 5: Enforce PKCE (S256)
FSI Server uses PKCE (Proof Key for Code Exchange) with the S256 (SHA-256) challenge method on every OIDC login request:
- The browser generates a cryptographic
code_verifierand sends its SHA-256 hash (code_challenge,code_challenge_method=S256) to Keycloak's authorization endpoint. - When exchanging the authorization code server-to-server, FSI Server's Java backend transmits both the Client Secret and the
code_verifierto Keycloak's token endpoint.
While Keycloak automatically validates PKCE whenever code_challenge is sent, it does not require PKCE for confidential clients by default unless explicitly configured. To enforce PKCE (S256) in Keycloak and prevent PKCE downgrade or authorization code injection attacks:
- In the client configuration of
fsi-server, navigate to the Advanced tab. - Scroll down to the Advanced settings section.
- Locate Proof Key for Code Exchange Code Challenge Method and select
S256from the dropdown list. - Click Save at the bottom of the Advanced settings section.
Combining Client authentication: ON (Client Secret) with PKCE (S256) follows OAuth 2.1 and OIDC security best practices for Backend-for-Frontend (BFF) web applications: the Client Secret authenticates the FSI Server backend, while PKCE binds the authorization code to the specific browser session that initiated the login.
Step 6: Record Client ID, Secret, and Issuer URL
- In the client menu for
fsi-server, navigate to the Credentials tab. - Verify that Client Authenticator is set to Client Id and Secret.
- Copy the string in the Client secret field. (If needed, you can regenerate this secret at any time using the regenerate button).
- Record the three values required for
settings.yml:- Client ID (
clientId):fsi-server(exact Client ID string from Step 3, not the UUID in the browser URL) - Client Secret (
clientSecret):<your-copied-client-secret> - Realm Issuer URL (
issuerUrl):https://<keycloak-domain>/realms/fsi(You can verify that this URL is reachable by openinghttps://<keycloak-domain>/realms/fsi/.well-known/openid-configurationin your browser).
- Client ID (
Step 7: Configure Token Group Claims (Protocol Mapper)
By default, Keycloak does not include user group memberships in the generated ID token. You must add a Group Membership Protocol Mapper to the client's dedicated scope:
- Navigate to:
👉 Clients →
fsi-server→ Client scopes tab. - Click on the dedicated client scope link in the table:
fsi-server-dedicated. - Under the Mappers tab:
- If no mappers exist yet (fresh client), click Configure a new mapper.
- If mappers are already listed, click Add mapper → By configuration.
- Select Group Membership from the list of mapper types.
- Configure the mapper settings:
- Name:
groups - Token Claim Name:
groups - Full group path: OFF (Disabled – see tip below)
- Add to ID token: ON (Enabled – Critical: FSI Server reads groups from the ID token)
- Add to access token: ON (or OFF)
- Add to lightweight access token: OFF
- Add to userinfo: ON
- Add to token introspection: ON
- Name:
- Click Save.
When Full group path is set to OFF (recommended), Keycloak emits clean group names in the ID token:
"groups": ["fsi-marketing", "fsi-administrators"]
If Full group path is left ON, Keycloak prepends a leading slash:
"groups": ["/fsi-marketing", "/fsi-administrators"]
If you keep Full group path enabled, you must include the leading slash / in your groupMapping keys in settings.yml (e.g., "/fsi-marketing": "marketing"). Setting it to OFF avoids this prefix requirement.
Step 8: Assign Users & Manage Federation
Option A: Local Keycloak Users
- In the left navigation (within realm
fsi), navigate to: 👉 Users → Create new user (or Add user). - Fill in Username, Email, First name, and Last name, then click Create.
- Under the Credentials tab, click Set password, enter a password, switch Temporary to OFF, and click Save.
- Under the Groups tab, click Join Group, check the appropriate connector group (e.g.,
fsi-marketingorfsi-administrators), and click Join.
Option B: Active Directory / LDAP User Federation
In enterprise deployments, Keycloak frequently synchronizes users and groups from Active Directory or OpenLDAP:
- Navigate to: 👉 User federation → Add Ldap providers (or Add provider → ldap).
- Configure connection settings, Bind DN, Users DN, and sync intervals.
- Once created, go to the Mappers tab of the LDAP provider and click Add mapper:
- Mapper type:
group-ldap-mapper - LDAP Groups DN:
OU=FSI Groups,DC=corp,DC=example,DC=com - Group Object Classes:
group(Active Directory) orgroupOfNames(OpenLDAP) - Mode:
READ_ONLY(orSYNC)
- Mapper type:
- Benefit: Enterprise Active Directory security groups are automatically mirrored into Keycloak groups, which FSI Server translates into connector access rules via
groupMappingwithout manual provisioning.
Option C: Multi-Factor Authentication (MFA / WebAuthn / Passkeys)
- Under Authentication → Flows, administrators can bind MFA policies (WebAuthn, Passkeys, Google Authenticator / FreeOTP) to the browser flow.
- Users logging into FSI Server are automatically prompted to complete MFA before Keycloak issues the authorization code.
Option D: Identity Brokering (Upstream Corporate IdP)
- If Keycloak acts as an identity broker for external IdPs (such as Okta, Google Workspace, or Ping Identity), navigate to Identity providers → select or add the upstream provider.
- Under the provider's Mappers tab, add a Claim to Group or Attribute to Group mapper to assign external directory users into Keycloak's
fsi-*connector groups automatically upon login.
FSI Server Configuration (settings.yml)
Configure the OIDC authentication module in settings.yml (located in the FSI Server configuration directory, e.g., /etc/fsi/fsi-server/config/settings.yml or ./config/settings.yml).
oidc Module- Single active
oidcentry: FSI Server uses the first enabledtype: "oidc"module inauthModules. If you previously tested another IdP (such as Microsoft Entra ID or authentik), remove or setenabled: falseon the previousoidcentry, and make sure no leftover manual endpoint overrides (authorizationUri,tokenUri,jwksUri) remain in the block. - Restart required: Changes to
settings.ymlare loaded at server startup. Restart FSI Server after savingsettings.ymlso the newclientIdandissuerUrltake effect—otherwise FSI Server will continue sending the previousclientIdfrom memory, causing Keycloak to reportClient not found.
The example below shows all parameters, highlighting mandatory settings and default values:
authentication:
authModules:
- type: "oidc" # Mandatory: Module type
enabled: true # Default: true
name: "Keycloak (SSO)" # Display label on login button
provider: "keycloak" # Provider identifier
# 1. Credentials from Keycloak Client (Steps 3 & 6)
clientId: "fsi-server" # Mandatory: Exact Client ID string from Keycloak (NOT the UUID!)
clientSecret: "your-client-secret-from-keycloak" # Mandatory: Client Secret value
# 2. Issuer URL (Endpoints are automatically discovered via .well-known/openid-configuration)
# Mandatory: Keycloak Realm URL (https://<keycloak-domain>/realms/<realm-name>)
issuerUrl: "https://auth.example.com/realms/fsi"
# 3. Redirect URI
# Default: Uses base request URL if omitted.
# Recommendation: Specify explicitly with [IP_ADDRESS] to match Keycloak Valid Redirect URIs.
redirectUri: "https://[IP_ADDRESS]/fsi/interface/"
# 4. Token Claims
usernameClaim: "preferred_username" # Default: "preferred_username" (or "email")
groupsClaim: "groups" # Default: "groups"
# 5. User Provisioning & Session Mode
autoProvision: true # Default: true (provisions user upon first SSO login)
# 6. Group Mapping: Map Keycloak Group Names to FSI Server Groups
# Note: FSI Server groups must correspond to defined group names
groupMapping:
# Full Administrator (Access to server settings & all connectors)
"fsi-administrators": "administrators"
# Marketing Team (Mapped to marketing connector)
"fsi-marketing": "marketing"
# Products Team (Mapped to product catalog connector)
"fsi-products": "products"
# Archive Team (Mapped to internal archive connector)
"fsi-archive": "archive"
# Optional: File-based XML authentication module as local administrative fallback
- type: "file"
enabled: true
Troubleshooting & Common Issues
| Error Code / Symptom | Potential Root Cause | Resolution |
|---|---|---|
We are sorry... Client not found. | 1. Wrong Realm: The client fsi-server was created inside the master realm instead of the fsi realm (or vice versa).2. clientId Mismatch: clientId in settings.yml contains Keycloak's internal UUID from the browser URL, or the display Name (FSI Server), instead of the exact case-sensitive Client ID (fsi-server).3. FSI Server Not Restarted / Multiple oidc Modules: FSI Server is still using an old clientId from memory because the server was not restarted after editing settings.yml, or an earlier - type: "oidc" block is still enabled in authModules. | 1. Inspect the browser URL on the Keycloak error page: /realms/<realm>/protocol/openid-connect/auth?client_id=<id>... and verify that <realm> matches the realm where the client was created and <id> matches Clients → Client ID in that realm.2. Set clientId: "fsi-server" in settings.yml to match the exact Client ID field in Keycloak.3. Ensure only one oidc module is enabled in settings.yml and restart FSI Server. |
Invalid parameter: redirect_uri | 1. Trailing slash missing or mismatched. 2. Keycloak protocol (HTTP vs. HTTPS) mismatch behind reverse proxy. | 1. Ensure https://<domain>/fsi/interface/ has the exact same trailing slash / in both Keycloak Valid redirect URIs and settings.yml.2. If running Keycloak behind a reverse proxy (e.g., NGINX, Traefik, Envoy), verify proxy headers ( KC_PROXY_HEADERS=xforwarded or proxy=edge). |
PKCE required or Invalid code verifier | PKCE Challenge Method in Keycloak was set to plain instead of S256, or a proxy stripped code_challenge parameters. | In Keycloak, navigate to Clients → fsi-server → Advanced tab → Advanced settings and ensure Proof Key for Code Exchange Code Challenge Method is set to S256 (or left blank). |
unauthorized_client or Invalid client secret | Client secret mismatch or Client Authentication disabled. | 1. Verify that Client authentication is set to ON in Keycloak client settings. 2. Regenerate or re-copy the secret from the Credentials tab and update clientSecret in settings.yml. |
Token missing groups (groups claim absent) | Group Membership protocol mapper not added or not enabled for ID tokens. | In Keycloak, open Clients → fsi-server → Client scopes → fsi-server-dedicated. Verify that the Group Membership mapper exists and Add to ID token is set to ON. |
| User logs in successfully but sees no connectors | 1. Group name mismatch due to Full group path setting (/fsi-marketing vs. fsi-marketing).2. Group name in groupMapping does not match FSI Server group.3. User not assigned to group in Keycloak. | 1. If Full group path is ON in the mapper, update settings.yml keys to include leading / (e.g., "/fsi-marketing": "marketing"), or switch Full group path to OFF.2. Verify that the target group exists in FSI Server ( groups.yml).3. Verify user group membership in Keycloak Admin Console. |
| Back-Channel Logout does not terminate user session | 1. Network connectivity / firewall between Keycloak and FSI Server. 2. Self-signed or untrusted SSL certificate on FSI Server. 3. Backchannel logout URL misconfigured. | 1. Ensure the Keycloak container/host can resolve and reach https://<fsi-domain>/fsi/service/oidc/logout over HTTPS.2. If using internal PKI/self-signed certificates, ensure Keycloak trusts the certificate authority (Java truststore). 3. Verify that Backchannel logout session required is enabled in Keycloak client settings (Settings tab → Logout settings). |
PKIX path building failed: unable to find valid certification path | FSI Server Java backend does not trust the internal/self-signed SSL certificate of Keycloak. | Import your corporate CA certificate into the JVM truststore used by FSI Server (keytool -importcert -keystore $JAVA_HOME/lib/security/cacerts -file ca.crt). |
Mixed Content or SSL Redirect Loop | FSI Server or Keycloak behind SSL-terminating reverse proxy without forwarded headers. | Ensure reverse proxy passes X-Forwarded-Proto: https and X-Forwarded-Host: <domain> to both FSI Server and Keycloak. In Keycloak, set KC_HOSTNAME and KC_PROXY_HEADERS. |