Add convenience method for constructing RoleHierarchy from Map #3990

Closed
thomasdarimont opened this Issue Jul 25, 2016 · 2 comments

Comments

Projects
None yet
2 participants
@thomasdarimont
Contributor

thomasdarimont commented Jul 25, 2016

Summary

Currently a RoleHierarchy needs to be constructed by creating a RoleHierarchyImpl which
interprets a string based definition of a role hierarchy.
Since this mapping only maps a role to a list of implied roles this could also be backed by a simple map.

It would be great if spring security would ship with method of constructing a RoleHierarchy from a
map which would nicely fit with a yaml based configuration approach which can be seen in the provided example.

Sample

See: https://gist.github.com/thomasdarimont/ee9fffdef1adb9243b12ad247478aad4

thomasdarimont added a commit to thomasdarimont/spring-security that referenced this issue Jul 25, 2016

Add convenience method for constructing RoleHierarchy from Map.
Introduced `RoleHierarchyUtils` which enables convenient
construction of `RoleHierarchy` from map based representation.
Where the map key is the role name and the map value is a list
of implied role names.

Here is a small example for that in action:
https://gist.github.com/thomasdarimont/ee9fffdef1adb9243b12ad247478aad4

Fixes #3990.

Signed-off-by: Thomas Darimont <thomas.darimont@gmail.com>

Signed-off-by: Thomas Darimont <thomas.darimont@gmail.com>

@jgrandja jgrandja self-assigned this Aug 29, 2016

@jgrandja jgrandja added this to the 4.2.0 M1 milestone Aug 29, 2016

@jgrandja jgrandja closed this in 06c6707 Sep 19, 2016

@thomasdarimont

This comment has been minimized.

Show comment
Hide comment
@thomasdarimont

thomasdarimont Sep 20, 2016

Contributor

Hello @jgrandja thanks for taking care of it.
I didn't find the time for reworking this :-(

See you at the next PR ;-)

Cheers,
Thomas

Contributor

thomasdarimont commented Sep 20, 2016

Hello @jgrandja thanks for taking care of it.
I didn't find the time for reworking this :-(

See you at the next PR ;-)

Cheers,
Thomas

@jgrandja

This comment has been minimized.

Show comment
Hide comment
@jgrandja

jgrandja Sep 20, 2016

Collaborator

No worries at all @thomasdarimont.
For sure, see you at the next PR!

Collaborator

jgrandja commented Sep 20, 2016

No worries at all @thomasdarimont.
For sure, see you at the next PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment