'keycloak map attributes to permission

Currently i am trying to add a large amount of users to keycloak, they have the attribute "impersonsate" over which i want to decide which of the users may impersonate.

Is there a way to use keycloaks built-in features to distribute the appropriate permission depending on this attribute?

If not, is there a way to do it within the UserProviderInterface or similar? Im adding the users using this Interface, so if theres a possibility, i could just decide inside my provider if the permission should be set.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source