OIDC with Active Directory
Active Directory on its own does not speak OpenID Connect, and ProjectAchilles never takes a password or binds to LDAP itself. To sign in with AD accounts, put an OIDC provider in front of AD and point the console's OIDC sign-in at that provider:
- Keycloak with LDAP user federation: Keycloak reads users and groups from AD and signs people in with their AD password. This is the supported route.
- AD FS is not supported today.
If your AD is already synchronised to Microsoft Entra ID, use Entra ID directly instead: that route is validated end to end.
Whatever sits in front of AD, the console needs four things from it:
- a confidential client with a client secret, using the authorization
code flow, with the redirect URI
https://achilles.example.com/api/auth/oidc/callback; - the person's console role as a value in a claim of the ID token
(
rolesby default, or the name you set inOIDC_ROLE_CLAIM), matchingOIDC_ROLE_MAP; - a refresh token, so the console can re-check each person every
OIDC_REVALIDATE_MINUTES(see When access ends); - a refusal of that refresh token once the account is disabled, so the re-check ends their access.
Keycloak with LDAP user federation
Set up the realm, the client, the client roles and the roles mapper as on the Keycloak page, steps 1 to 4. Then connect AD and turn AD groups into the console's client roles.
Connect AD
In the realm, open User federation and add an LDAP provider:
- Vendor: Active Directory.
- Connection URL:
ldaps://dc01.example.org:636. Use LDAPS: Keycloak sends AD the passwords people type. Keycloak must trust the domain controllers' certificate (a Keycloak setting, not a console one). - Bind type: simple, with a Bind DN and Bind credentials of a service account that can read users and groups and nothing more.
- Edit mode:
READ_ONLY. AD stays the source of truth. - Users DN: the OU that holds the people who may use the console, for
example
OU=Staff,DC=example,DC=org. - Username LDAP attribute:
sAMAccountName(oruserPrincipalName), whichever people type to sign in.
Save, then test the connection and the bind from the same page.
Turn AD groups into console roles
Create four AD groups, for example Achilles-Admins, Achilles-Operators,
Achilles-Analysts and Achilles-Explorers, in one OU, and add people to
them. Then, on the LDAP provider's Mappers tab, add a mapper of type
role-ldap-mapper:
- LDAP Roles DN: the OU that holds the four groups;
- Role Name LDAP Attribute:
cn; - Role Object Classes:
group; - Membership LDAP Attribute:
member; - Mode:
READ_ONLY; - Use Realm Roles Mapping: Off;
- Client ID: the console's client (
achilles).
Each group becomes a client role of the console's client with the group's
name, and the roles mapper from the Keycloak page puts it into the ID token's
roles claim. Map the group names to console roles:
OIDC_ROLE_MAP='admin=Achilles-Admins,operator=Achilles-Operators,analyst=Achilles-Analysts,explorer=Achilles-Explorers'
Values are compared case for case, so write them exactly as the groups are named. You can delete the four client roles you created by hand on the Keycloak page, or keep them for people who are not in AD.
Check before going live
- The
offline_accessrole. Federated users may not get the realm's default roles. A user without theoffline_accessrole cannot sign in (the backend logserror="not_allowed"). Check one federated user's Role mapping tab; ifdefault-roles-<realm>is missing, assign it (see Keycloak: refresh tokens). - A disabled AD account must end access. Disable a test account in AD,
wait one
OIDC_REVALIDATE_MINUTES, and check that its next console request fails and the backend logswas marked inactive. If it keeps access, Keycloak is not refusing the refresh token for disabled AD accounts; fix that in Keycloak before relying on it. - A person removed from every group must land on "Your account has no role in this console." at their next sign-in or re-check.
AD FS
The console cannot get a role from AD FS, for two reasons:
- Roles in the ID token. The console reads the role from the ID token
only. AD FS adds extra claims, such as roles, to the ID token only when the
sign-in asks for
response_mode=form_post(and theallatclaimsscope). The console's callback accepts the provider's answer in the address only (a GET), never a form post. - No configurable rules. The console sends no
resourceparameter, so AD FS issues its tokens for its default resource,urn:microsoft:userinfo, whose issuance rules cannot be configured. A rule that sends AD groups as roles never applies to the console's sign-in. Also,offline_access, which the console asks for to get a refresh token, is not an AD FS scope.
Both come from Microsoft's AD FS OpenID Connect/OAuth concepts and the console's code. Put Keycloak in front of AD instead. If your AD is synchronised to Entra ID, use Entra ID.
Claim names
| Route | The claim | OIDC_ROLE_CLAIM | OIDC_ROLE_MAP values |
|---|---|---|---|
| Keycloak, role-ldap-mapper + User Client Role mapper | roles (a list) | roles (default) | the AD group names |
| Keycloak, realm roles instead of client roles | realm_access.roles, if your mapper adds it to the ID token | realm_access.roles | the role names |
| Entra ID (AD synchronised to Entra) | roles | roles (default) | the app role Values |