-
Notifications
You must be signed in to change notification settings - Fork 96
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
Allow to remove header group prefix #207
Allow to remove header group prefix #207
Conversation
@@ -77,6 +81,9 @@ protected void authenticate(HttpServletRequest req) { | |||
if (groupName.equals(GroupReservedNames.EVERYONE.groupName())) { | |||
everyoneFound = true; | |||
} | |||
if(groupHeaderPrefix != null && groupName.startsWith(groupHeaderPrefix)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be useful to implement a more generic (and optional) groupName mapper that transforms group names using an SpEl expression.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought about it, I didn't do that because testing was hard. Now I'm more confident and I think I can do it relatively quickly
I need a map of regex --> expression.
@@ -77,6 +81,9 @@ protected void authenticate(HttpServletRequest req) { | |||
if (groupName.equals(GroupReservedNames.EVERYONE.groupName())) { | |||
everyoneFound = true; | |||
} | |||
if(groupHeaderPrefix != null && groupName.startsWith(groupHeaderPrefix)) { | |||
groupName = groupName.replaceAll(groupHeaderPrefix, ""); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is going to transform ROLE_SOMETHINGROLE_ into SOMETHING, because of replaceAll
This PR allows to remove from role headers a prefix for mapping groups.