I am not sure but you can do something like this to map the role with your user.
for(String role : listOfRoles) {
RoleModel roleModel = realmModel.getRole(role);
if(roleModel != null) {
userModel.grantRole(roleModel);
}
}
Regards,
Kruti
-----Original Message-----
From: keycloak-user-bounces(a)lists.jboss.org [mailto:keycloak-user-bounces@lists.jboss.org]
On Behalf Of Rob Shepherd
Sent: 04 November 2017 05:48 PM
To: keycloak-user(a)lists.jboss.org
Subject: [keycloak-user] Roles from UserStorageSPI
Hi,
I have successfully authenticated users from a custom User Storage Provider.
I cannot find how I map roles to the users that come from this provider.
I am able to include the user's roles in the UserModel, and i have created ClientRoles
which match, but I can’t find how I attribute Roles to my users.
Furthermore, I have a default realm role, but this never appears in the ID token or
userInfo object.
Any pointers appreciated.
Thanks
Rob
_______________________________________________
keycloak-user mailing list
keycloak-user(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/keycloak-user
***** Email confidentiality *****
This message is private and confidential. If you have received this message in error,
please notify us and remove it from your system. The dissemination, copying or
distribution of this message, or related files, by anyone other than the intended
recipient is strictly prohibited.
Any views or opinions expressed are solely those of the author and do not necessarily
represent those of Advanced Computer Software Group Limited.
***** Email monitoring *****
Advanced Computer Software Group Limited may monitor email traffic data and also the
content of email for the purposes of security and staff training.
***** Email security *****
In keeping with good computing practice, the recipient of this email should ensure that it
is virus-free. Advanced Computer Software Group Limited does not accept responsibility for
any virus that may be transferred by way of this email.
Email may be susceptible to data corruption, interception and/or unauthorised amendment.
Advanced Computer Software Group Limited does not accept liability for any such
corruption, interception or amendment or any consequences thereof.
This email has been scanned for viruses by the Symantec Email Security.cloud service.
Advanced Computer Software Group Limited
Registered office: Ditton Park, Riding Court Road, Datchet, Berkshire, SL3 9LL, UK
Registered in England under number 5965280
________________________________
Please consider the environment: Think before you print!
This message has been scanned for malware by Websense.
www.websense.com