Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP Security Policy should support the role mappings #5255

Closed
sberyozkin opened this issue Nov 6, 2019 · 4 comments · Fixed by #37275
Closed

HTTP Security Policy should support the role mappings #5255

sberyozkin opened this issue Nov 6, 2019 · 4 comments · Fixed by #37275
Assignees
Labels
area/security kind/enhancement New feature or request
Milestone

Comments

@sberyozkin
Copy link
Member

sberyozkin commented Nov 6, 2019

Description
@michalszynkiewicz has discovered that Quarkus MP-JWT TCK does not run RolesAllowedTest.testNeesGroup1Mapping because it is part of the optional ee-security test group, but in fact it does not depend on the container supporting EE-Security, all it tests is that a container is able to map a role set in the token to the role listed in @RolesAllowed.

For example, given this token's groups claim and a role mapping configuration like this one (as used in Thorntail), this @RolesAllowed restriction should work.

This can be useful when the role names used by OIDC IDP admins are different to those used in the actual endpoints.

Implementation ideas
Update Quarkus HTTP security policy mechanism to let users map the token specific roles to the container specific roles:
role1=mappedrole1,mappedrole2 or role1=mappedrole1

Alternatively we can update both quarkus-smallrye-jwt (or smallrye-jwt itself) and quarkus-oidc to map, but it appears it would be better to map after the roles have been extracted in either of those extensions

@sberyozkin sberyozkin added kind/enhancement New feature or request area/security labels Nov 6, 2019
@sberyozkin
Copy link
Member Author

Hi @stuartwdouglas What do you think about this one ?

@sberyozkin
Copy link
Member Author

sberyozkin commented Jul 17, 2020

If the token contain some role names, the way they've been set up in Keycloak Admin console, etc, then it can be useful to map them to the deployment specific roles, ex, admin -> Administrator, etc, especially if the role in the token does represent a real group, say admins which we would map to admins=Admin,SuperAdmin.

@stuartwdouglas
Copy link
Member

We can do this using a SecurityIdentityAugmentor, which gives complete freedom in mapping as you do it programatically. I don't know if we want a config based option or not.

@sberyozkin
Copy link
Member Author

@michalvavrik FYI, if you are interested, please have a look, I agree with Stuart an augmentor can help, but having an option to configure the mappings can be useful too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/security kind/enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants