You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
create_mapper in keycloak-init/keycloak_init.py hardcodes protocolMapper: "oidc-usermodel-attribute-mapper", so it can only create
user-attribute mappers. There's no way to configure an audience mapper, so
realm clients get only Keycloak's default aud (e.g. ["account"]).
Request: let a mapper entry specify its type and, for oidc-audience-mapper,
set included.client.audience / included.custom.audience with access.token.claim=true, driven from the realm YAML config.
Acceptance criteria:
A mapper entry can declare its type (default stays oidc-usermodel-attribute-mapper).
oidc-audience-mapper entries support included_client_audience or
included_custom_audience and emit the value into the access token's aud.
The Keycloak init script now supports audience mappers. The change is merged in mosip/keycloakrelease-1.3.x through mosip/keycloak#216 (be56a7e).
keycloak-init/keycloak_init.py no longer hardcodes oidc-usermodel-attribute-mapper. Each client mappers entry is passed to mapper_payload:
Leave protocol_mapper unset, or set oidc-usermodel-attribute-mapper, to keep the existing user-attribute mapper (mapper_name, mapper_user_attribute, token_claim_name).
Set protocol_mapper: oidc-audience-mapper and exactly one of included_client_audience or included_custom_audience. The script sets access.token.claim to true and adds that value to the access token aud.
An entry with both audience fields, or any other protocol_mapper, is rejected before a realm or client is created. A re-run skips a mapper name that already exists (HTTP 409). To change an audience, delete that mapper in Keycloak and run init again.
Tested on a fresh Keycloak in the Nexus cluster with keycloak_init.py from release-1.3.x. Init created esignet-audience on mosip-pms-client as oidc-audience-mapper with included.client.audience=mosip-ida-client and access.token.claim=true. Running init again updated the realm and clients and skipped that mapper.
The Helm chart image tag is still mosipid/keycloak-init:1.3.0. The merge published the new script as mosipid/keycloak-init:release-1.3.x. deploy/keycloak/keycloak-init.sh installs chart 12.0.2, which uses tag 1.3.0, so that job does not pick up this change until the image tag is updated. The audience entry in helm/keycloak-init/values.yaml is a comment; add it on the client that needs it.
Activity
Merge pull request #216 from mosip/Ivanmeneges-patch-2
Ivanmeneges commentedon Oct 23, 2026
The Keycloak init script now supports audience mappers. The change is merged in
mosip/keycloakrelease-1.3.xthrough mosip/keycloak#216 (be56a7e).keycloak-init/keycloak_init.pyno longer hardcodesoidc-usermodel-attribute-mapper. Each clientmappersentry is passed tomapper_payload:protocol_mapperunset, or setoidc-usermodel-attribute-mapper, to keep the existing user-attribute mapper (mapper_name,mapper_user_attribute,token_claim_name).protocol_mapper: oidc-audience-mapperand exactly one ofincluded_client_audienceorincluded_custom_audience. The script setsaccess.token.claimtotrueand adds that value to the access tokenaud.protocol_mapper, is rejected before a realm or client is created. A re-run skips a mapper name that already exists (HTTP 409). To change an audience, delete that mapper in Keycloak and run init again.Example:
Tested on a fresh Keycloak in the Nexus cluster with
keycloak_init.pyfromrelease-1.3.x. Init createdesignet-audienceonmosip-pms-clientasoidc-audience-mapperwithincluded.client.audience=mosip-ida-clientandaccess.token.claim=true. Running init again updated the realm and clients and skipped that mapper.The Helm chart image tag is still
mosipid/keycloak-init:1.3.0. The merge published the new script asmosipid/keycloak-init:release-1.3.x.deploy/keycloak/keycloak-init.shinstalls chart12.0.2, which uses tag1.3.0, so that job does not pick up this change until the image tag is updated. The audience entry inhelm/keycloak-init/values.yamlis a comment; add it on the client that needs it.Ivanmeneges commentedon Oct 26, 2026
After it was tested and worked fine raised the same changes to develop branch and below is the PR for the same
PR: mosip/keycloak#217
Ivanmeneges commentedon Oct 27, 2026
The PR has been merged for the same so now the request has been in place in both develop and release-1.3.x