Hello KC community,
I have set up a KC server (v26) with a user federation (Active Directory) and an external OIDC identity provider (Belgian federal authentication service - CSAM).
So, a client application using the KC server to authenticate its users offers two authentication methods.
The first method, using a username and password from our Active Directory, can only be used by employees. The second method, via CSAM, can be used by any citizen or person working in Belgium.
In the KC user model, a field called “nrn” has been added. It is populated with the unique identifier assigned by the state to every citizen. This field is mapped both to a field in our AD users and to an attribute returned by CSAM.
That’s the context.
The issue is the following:
I have a client application where only employees should be allowed to log in. However, I want them to be able to use CSAM to do so.
However, since CSAM allows any citizen to log in, I need a way for Keycloak to verify — when CSAM is used as the identity provider — whether the authenticated user is actually an employee (i.e., present in our AD), and to make this information available to the client application (e.g., via a claim).
I don’t see how I can do that.
Additional note: there is no filtering possible on the client application side.