<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hey all,<div class=""><br class=""></div><div class="">I was going to create a JIRA for this, but just want to make sure it’s an actual bug. We are not able to assign roles to a user from a federation provider.</div><div class=""><br class=""></div><div class="">For example, we expected something like this to work from&nbsp;UserFederationProvider. getUserByUsername(RealmModel realm, String username):</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 11px; font-family: Menlo; color: rgb(102, 102, 102);" class="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;if (remoteUser.getRoles() != null) {</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; color: rgb(102, 102, 102);" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (String roleName : remoteUser.getRoles()) {</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; color: rgb(102, 102, 102);" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; RoleModel role = realm.getRole(roleName);</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; color: rgb(102, 102, 102);" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; userModel.getRoleMappings().add(role); // doesn’t work</div><div style="margin: 0px;" class=""><span style="color: rgb(102, 102, 102); font-family: Menlo; font-size: 11px;" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: rgb(102, 102, 102); font-family: Menlo; font-size: 11px;" class="">&nbsp;</span><font color="#666666" face="Menlo" class=""><span style="font-size: 11px;" class="">userModel.getRealmRoleMappings().add(role);&nbsp;</span></font><span style="color: rgb(102, 102, 102); font-family: Menlo; font-size: 11px;" class="">// doesn’t work</span></div><div style="margin: 0px; font-size: 11px; font-family: Menlo; color: rgb(102, 102, 102);" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; color: rgb(102, 102, 102);" class="">&nbsp; &nbsp; &nbsp; &nbsp; }</div></div><div class=""><br class=""></div><div class="">However, nothing but the default role is assigned even when we confirm additional roles are assigned to remoteUser and realm.getRole() returns a valid RoleModel.</div><div class=""><br class=""></div><div class="">Create JIRA or should we be assigning roles from a UserFederationProvider in another way?</div><div class=""><br class=""></div><div class="">Thanks</div></body></html>