Skip to content

Conversation

@andreblanke
Copy link
Contributor

@andreblanke andreblanke commented Jun 28, 2025

The provider option "Enable nested and fallback claim mappings" recently introduced in #1103 currently doesn't work for the groups attribute mapping since getSyncGroupsOfToken uses $groupsAttribute for directly accessing properties inside $idTokenPayload (instead of using getClaimValue to allow for dot-notation resolution).

This is unfortunate because some identity providers, such as Keycloak, nest user roles inside the ID token (e.g., under realm_access.roles for Keycloak realm-level and resource_access.${client_id}.roles for Keycloak client-level roles).

My PR fixes the issue by adding the method getClaimValues and using it inside of getSyncGroupsOfToken. getClaimValues includes most of the logic of getClaimValue, but allows returning non-string values. The original behavior of getClaimValue is retained.

Closes #799.

@julien-nc julien-nc self-requested a review July 8, 2025 10:22
Copy link
Member

@julien-nc julien-nc left a comment

Choose a reason for hiding this comment

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

Works fine. Thank you!

@julien-nc
Copy link
Member

To fix the tests, you need to extend what the mocked getSetting method will return for SETTING_RESOLVE_NESTED_AND_FALLBACK_CLAIMS_MAPPING.

I'll check if I can push in your branch and maybe do it.

andreblanke and others added 2 commits July 8, 2025 12:42
@julien-nc
Copy link
Member

Fixed the tests, rebased on main, all good.

@julien-nc julien-nc merged commit d2cb2ae into nextcloud:main Jul 8, 2025
39 checks passed
@andreblanke
Copy link
Contributor Author

Thank you, too, for the merge and the test fix.

@github-actions
Copy link

Hello there,
Thank you so much for taking the time and effort to create a pull request to our Nextcloud project.

We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process.

Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6

Thank you for contributing to Nextcloud and we hope to hear from you soon!

(If you believe you should not receive this message, you can add yourself to the blocklist.)

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.

Support for group mapping from mulitple (nested?) entries

2 participants