-
Notifications
You must be signed in to change notification settings - Fork 15
Setting up SSO with Keycloak
A complete, copy-paste walkthrough for standing up Keycloak in Docker as an OpenID Connect identity provider and wiring it into FreeITSM. Keycloak is free, open-source, and the easiest way to evaluate FreeITSM's SSO / OIDC support β but the same FreeITSM steps apply to Entra, Okta, Google, etc.
This guide uses Keycloak's development mode (plain HTTP, throwaway settings). It's perfect for local evaluation but not for production β see Going to production at the end.
- Docker installed and running (Docker Desktop on Windows/Mac).
- FreeITSM running and reachable in a browser (this guide assumes
http://localhost/freeitsm-app/). - Port 8080 free (Keycloak's default; FreeITSM stays on your web server's own port).
Create a folder for the stack (keep it outside your web root β it isn't part of FreeITSM), e.g. C:\Users\<you>\docker\keycloak\, and add a docker-compose.yml:
services:
keycloak:
image: quay.io/keycloak/keycloak:latest
container_name: keycloak
command: start-dev # dev mode: plain HTTP, no TLS certs needed
environment:
KC_BOOTSTRAP_ADMIN_USERNAME: admin
KC_BOOTSTRAP_ADMIN_PASSWORD: admin
ports:
- "8080:8080"
volumes:
- keycloak_data:/opt/keycloak/data # persists realm/clients/users across restarts
volumes:
keycloak_data:Start it:
docker compose up -d # first run pulls the image (~400 MB)
docker compose logs -f # watch it boot (optional)When it's up, open http://localhost:8080 β Administration Console and log in with admin / admin.
Useful commands later:
docker compose down # stop (keeps your data)
docker compose down -v # stop AND wipe the realm/users/clientsTip β a proper admin: the
admin/adminaccount is a temporary bootstrap account. For anything beyond a quick test, create a permanent admin: in the master realm β Users β add a user β set a password (toggle Temporary off) β Role mapping β assign theadminrealm role.
A realm is an isolated space for your application's users and clients (keep them out of the master admin realm).
- Top-left realm dropdown β Create realm
-
Realm name:
freeitsm - Create
The dropdown should now show freeitsm β everything below happens inside this realm.
The client represents FreeITSM inside Keycloak. Clients β Create client.
Step 1 β General settings
-
Client type:
OpenID Connect -
Client ID:
freeitsm-app(this is the Client ID you'll enter in FreeITSM) -
Name:
FreeITSM - Next
Step 2 β Capability config
- Client authentication: On (makes it a confidential client β it gets a secret)
- Authorization: Off
- Authentication flow: tick Standard flow only
- Next
Step 3 β Login settings
-
Root URL:
http://localhost/freeitsm-app/ -
Home URL:
/ -
Valid redirect URIs:
http://localhost/freeitsm-app/api/auth/oidc_callback.php(this is the redirect URI shown on FreeITSM's System β Single Sign-On page β copy the exact value from there) -
Valid post logout redirect URIs:
http://localhost/freeitsm-app/ -
Web origins:
http://localhost - Save
Now open the client's Credentials tab and copy the Client secret β you'll paste it into FreeITSM in step 5.
Users β Add user:
-
Username:
alice -
Email:
alice@example.com(needn't be real β no email is sent; it's used to match/identify the analyst) - Email verified: On
- First / last name: anything
- Create
Then Credentials β Set password, enter a password, toggle Temporary off, Save.
In FreeITSM go to System β Single Sign-On:
- In Global settings, turn Enable single sign-on on and Save.
- Under Identity providers click Add and enter:
-
Display name:
Sign in with Keycloak -
Issuer URL:
http://localhost:8080/realms/freeitsmβ click Test (should report Discovery OK) -
Client ID:
freeitsm-app - Client secret: (paste the value from Keycloak's Credentials tab)
-
Scopes: leave as
openid email profile - Enabled: on
- Auto-create users (JIT): on (simplest for testing β auto-creates the analyst on first login; leave Default module access blank only if you're happy the user gets full access)
-
Display name:
- Save.
- Log out of FreeITSM (or use a private/incognito window) to reach the login page.
- Either type
alice@example.comand click Continue, or click the Sign in with Keycloak button. - You're redirected to Keycloak β sign in as
alice/ (the password you set). - Keycloak redirects back and FreeITSM logs you in. With JIT on, an analyst for Alice is created and linked automatically.
That's a full OIDC round-trip working end to end. π
| Symptom | Likely cause / fix |
|---|---|
| "Invalid parameter: redirect_uri" at Keycloak | The Valid redirect URIs in the client doesn't exactly match FreeITSM's callback. Copy the URI from System β Single Sign-On verbatim (scheme, host, path). |
| "Security check failed (state mismatch)" | Session/cookie was lost mid-flow, or you reused an old login tab. Start the sign-in again from the login page. |
| "ID token nonce/issuer/audience mismatch" | Issuer URL is wrong (must be http://localhost:8080/realms/freeitsm, no trailing slash needed) or the client ID doesn't match. Re-run Test. |
| "Token exchange failed: invalid_client" | Wrong/blank client secret, or Client authentication wasn't On. Re-copy the secret from Keycloak's Credentials tab and re-save the provider. |
| "Your email is not verifiedβ¦" | Set Email verified: On for the user in Keycloak. |
| No "Sign in with Keycloak" button | Enable single sign-on is off, or the provider isn't Enabled. Hard-refresh the login page (Ctrl+F5). |
| Clock-skew / expiry errors | The token validator allows 60s of leeway; make sure the host clock and the container clock are roughly in sync. |
Development mode (start-dev, HTTP, the in-container database) is for evaluation only. For a real deployment:
- Run Keycloak in production mode (
start) behind HTTPS with a valid certificate, and setKC_HOSTNAME. - Use an external database (PostgreSQL) rather than the dev store.
- Replace the bootstrap
admin/adminwith a real admin account and a strong password. - Use HTTPS URLs for the FreeITSM redirect URI, and configure FreeITSM behind TLS too.
- Consider Keycloak's own MFA, brute-force detection and session policies β with SSO, the IdP owns authentication and MFA.
- Single Sign-On (SSO / OIDC) β the feature reference (configuration, account mapping, break-glass, other providers)
- Security β wider authentication and encryption details
FreeITSM β an open-source IT Service Management platform Β· github.com/edmozley/freeitsm Β· MIT licence
- Installation
- β° Scheduled tasks (cron jobs)
- Architecture
- AI Providers
- Internationalisation (i18n)
- Timezones & Time Handling
- Theming & Dark Mode
- β¨οΈ Command palette (βK)
- π Searching inside tickets
- π Attached documents
- MobileβFriendly
-
Security
- Layer 1 β which modules you can enter
- β³ π§© Module Access Control
- β³ π οΈ Module Access β Developer Guide
- Layer 2 β what you can administer
- β³ π Roles & Permissions
- β³ π οΈ Roles β Developer Guide
- β³ π€ Why capabilities are constants
- Layer 3 β the System module
- β³ π Admin Access Control
- Hardening
- β³ π Security review response 2026-08
- β³ π‘οΈ Security hardening 2026-08
- β³ π οΈ Security hardening 2026-08 β Developer Guide
- β³ π‘οΈ Round three β plain English
- β³ π οΈ Round three β Developer Guide
- Single Sign-On (SSO)
- ποΈ LDAP & Active Directory
- Browser Extension
- API Reference
-
π REST API β how it works
- β³ π« REST API: Tickets
- β³ π» REST API: Assets
- β³ π΄ REST API: Problems
- β³ π REST API: Changes
- β³ π REST API: Knowledge
- β³ β REST API: Tasks
- β³ ποΈ REST API: CMDB
- β³ π REST API: Contracts
- β³ ποΈ REST API: Calendar
- β³ πΏ REST API: Software
- β³ π¦ REST API: Service Status
- β³ βοΈ REST API: Morning Checks
- β³ π REST API: Forms
- β³ βοΈ REST API: Workflow
- β³ πΊοΈ REST API: Network Mapper
- β³ π§ Using the API docs page
- β³ π OpenAPI specification
- β³ β OpenAPI: kept correct
- β³ π οΈ Maintaining the catalogue
- Watchtower
-
Tickets
- β³ Mailbox Authentication
- β³ π€ Email send log
- β³ Basic IMAP mailboxes
- β³ Email rendering & images
- β³ SLA Management
- β³ WhatsApp channel
- β³ π¬ Web chat channel
- β³ π£ Slack channel
- β³ π Linking tickets
- β³ ποΈ Canned responses
- β³ βοΈ Limiting replies to particular senders
- β³ βοΈ Email signatures
- β³ π The public web address
- β³ π Raising a ticket for someone else
- β³ π Merging tickets
- β³ β Splitting tickets
- β³ β Selecting several tickets
- β³ π οΈ Snoozing tickets β Developer Guide
- β³ π₯ Collision detection
- β³ β±οΈ Time tracking
- Problem Management
- Tasks
- Assets
- Knowledge
- Change Management
- Calendar
- Morning Checks
- Reporting
- Software
- Forms
- Contracts
- Service Status
- π Notifications
- π¨ War Room
- Self-Service Portal
- LMS
- Process Mapper
- CMDB
- Network Mapper
- Workflows
- Issue trackers (Jira, Azure DevOps)
- System
-
Overview
- β³ π Progress tracker
- β³ Concepts & vocabulary
- β³ Email routing & mailboxes
- β³ Settings: global vs per-company
- β³ Users & self-service
- β³ Staff cross-company access
- β³ Worked examples
- β³ Pitfalls & gotchas
- β³ Scope: what it's for
- β³ π οΈ Developer Guide (make a module multi-company)
- β³ ποΈ Case study: CMDB (a linked graph)
- β³ π§ͺ Test harness (prove it's isolated)