-
Notifications
You must be signed in to change notification settings - Fork 18
Assign roles based on Attribute values #6
Copy link
Copy link
Open
Description
This is dependent on attributes being loaded (Issue #5).
Rather than only assigning the static ROLE_USER to all users who can authenticate via CAS, I'd like to be able to assign configurable roles based on user-attribute values.
For example, imagine a school with guests, students, faculty, and administrators. One application should only be available to students and faculty, so a configuration like the following might be used:
p_rayno_cas_auth:
server_login_url: https://server.example.edu/cas/
...
attribute_role_mapping:
ROLE_USER:
attribute_key: 'Status'
attribute_values: ['Student', 'Faculty']
ROLE_ADMINISTRATOR:
attribute_key: 'MemberOf'
attribute_values: ['CN=AdministratorsGroup,OU=Groups,DC=example,DC=edu']
If no attribute_role_mapping was defined, the existing behavior of all users getting ROLE_USER would be maintained.
There are likely other ways of mapping attributes to roles, both inside the CasAuthBundle or outside it after successful authentication. Any feedback on preferred ways of approaching this would be welcome.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels