8000 Implemented OIDC Prefixed User Attribute Mapper by pszabo891 · Pull Request #39930 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content

Implemented OIDC Prefixed User Attribute Mapper - #39930

Closed
pszabo891 wants to merge 1 commit into
keycloak:mainfrom
pszabo891:prefixed-user-attribute-mapper
Closed

pszabo891 wants to merge 1 commit into
keycloak:mainfrom
pszabo891:prefixed-user-attribute-mapper

Conversation

@pszabo891
Copy link
Copy Markdown

The new OIDC mapper adds the possibility to prefix the values of the claims when imported into user attributes.

image

Closes #39929

@pszabo891
pszabo891 requested review from a team as code owners May 23, 2025 19:30
@pszabo891
pszabo891 force-pushed the prefixed-user-attribute-mapper branch 7 times, most recently from 2695552 to 974464b Compare May 30, 2025 18:17
@pszabo891
pszabo891 force-pushed the prefixed-user-attribute-mapper branch 3 times, most recently from c8797af to 88e2136 Compare June 4, 2025 13:18
@pszabo891
pszabo891 force-pushed the prefixed-user-attribute-mapper branch 2 times, most recently from 232c876 to fcc575f Compare June 16, 2025 07:13
@pszabo891
pszabo891 force-pushed the prefixed-user-attribute-mapper branch from fcc575f to f26a93a Compare June 18, 2025 08:55
@pszabo891
pszabo891 force-pushed the prefixed-user-attribute-mapper branch 2 times, most recently from adec397 to e1acf1f Compare July 6, 2025 11:34
@pszabo891
pszabo891 force-pushed the prefixed-user-attribute-mapper branch from e1acf1f to aaf699f Compare July 10, 2025 20:21
@pszabo891
pszabo891 force-pushed the prefixed-user-attribute-mapper branch from aaf699f to b35b80b Compare August 18, 2025 08:45
@pedroigor pedroigor left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pszabo891 The new mapper makes sense for me, but don't we want to extend the UserAttributeMapper and add the prefix logic on top of it?

@pszabo891
Copy link
Copy Markdown
Author

@pedroigor I have implemented the mapper originally as a plugin, so creating a new mapper was the most straightforward way to bring the functionality into the codebase without changing existing code.

I'm happy to rework it and implement as part of the UserAttributeMapper if there is interest in merging it. I will raise a new PR and tag you along.

@pedroigor
Copy link
Copy Markdown
Contributor

I think we can have it as a separate mapper, but with the prefixing logic applied to values. The admin would usually choose between your mapper or the regular user attribute mapper, but never both, right?

Another concern I have is how to solve conflicts with the root attributes, such as email, first, and last names. Now they will be prefixed and, considering they are single-valued, the last update will win?

@pszabo891
Copy link
Copy Markdown
Author

@pedroigor If we keep it as a separate mapper, you are correct, for each claim only one mapper will be needed - either the UserAttributeMapper or the PrefixedUserAttributeMapper - it's up to the Administrator to decide.

Those root attributes are only impacted by the prefixing mapper if the Administrator explicitly configures the mapper for them and then it behaves as expected, although there might not be a real use case for prefixing those attributes. Or perhaps I missed something?

If prefixing the root attributes is a concern, we can also implement it so, that we skip them and apply the prefix only to the rest of the attributes.

@pszabo891
pszabo891 force-pushed the prefixed-user-attribute-mapper branch from b35b80b to b63f77d Compare August 18, 2025 15:19
Signed-off-by: Peter Szabo <petersz.szabo@gmail.com>
@pszabo891
pszabo891 force-pushed the prefixed-user-attribute-mapper branch from b63f77d to f0fe1b8 Compare August 18, 2025 16:06
@pedroigor
Copy link
Copy Markdown
Contributor

From a UX perspective, keeping a single mapper is better so that we can add the prefix configuration property to the UserAttributeMapper and handle the values accordingly if a prefix is set. Otherwise, I'm afraid that people will be confused about when to use one or another, or even have both in their broker configuration.

Regarding the root attributes, I don't think it makes much sense to use a prefix on them. I cannot think about a use case mainly because the values would be shown everywhere. Imagine the account console showing as your first name <prefix>Joe. But as you said, it is a matter of configuration, and if the admin sets a prefix for any of the root attributes, they will be prefixed too.

@pszabo891
Copy link
Copy Markdown
Author

@pedroigor I have created a new PR #42002 which adds the prefixing functionality in the existing mapper.

@pedroigor
Copy link
Copy Markdown
Contributor

Thanks. Closing in favor of #42002.

@pedroigor pedroigor closed this Aug 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Prefixed User Attribute Importer for OIDC IdP

2 participants

0