Attribute Importer IdP mapper with blank claim makes IdP brokering fail and is hard to find
#46 137 ouverte le 9 févr. 2026
Métriques du dépôt
- Stars
- (34 398 stars)
- Métriques de merge PR
- (Merge moyen 6j 19h) (384 PRs mergées en 30 j)
Description
Before reporting an issue
- I have read and understood the above terms for submitting issues, and I understand that my issue may be closed without action if I do not follow them.
Area
identity-brokering
Describe the bug
When the IdP Mapper of type Attribute Importer has no claim configured, this results in the following Error in the log
Failed to make identity provider oauth callback
java.lang.NullPointerException: Cannot invoke "String.hashCode()" because "<local2>" is null
at org.keycloak.broker.oidc.mappers.AbstractClaimMapper.getClaimValue(AbstractClaimMapper.java:46)
at org.keycloak.broker.oidc.mappers.AbstractClaimMapper.getClaimValue(AbstractClaimMapper.java:99)
at org.keycloak.broker.oidc.mappers.AbstractClaimMapper.getClaimValue(AbstractClaimMapper.java:72)
at org.keycloak.broker.oidc.mappers.UserAttributeMapper.preprocessFederatedIdentity(UserAttributeMapper.java:113)
The user gets "Unexpected error when authenticating with identity provider"
Version
26.4.8
Regression
- The issue is a regression
Expected behavior
- Incomplete mapper configuration can't be saved
- Null check and appropriate exception with message "Claim is null at IdP mapper 'my-mapper' for idp 'my-alias'".
Note: 1. would be nice to have, 2. is essential to find the configuration error and get login with an IdP with such an error working again.
Actual behavior
Incomplete configuration can be saved. Root cause hard to find as the mapper has to be found by checking all configured mappers.
How to Reproduce?
Create an IdP mapper of type Attribute Importer with claim left blank:
Anything else?
The IdP mapper of type Attribute Importer can also be saved without target attribute, but this doesn't make the login fail.