use of org.qi4j.library.shiro.domain.permissions.RoleAssignee in project qi4j-sdk by Qi4j.
the class PasswordRealmMixin method doGetAuthorizationInfo.
@Override
protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) {
UnitOfWork uow = module.newUnitOfWork();
try {
String username = getAvailablePrincipal(principals).toString();
RoleAssignee roleAssignee = findRoleAssignee(uow, username);
if (roleAssignee == null) {
LOG.debug("No authorization info for {}", username);
return null;
}
LOG.debug("Found role assignee for {}: {}", username, roleAssignee);
Set<String> roleNames = roleAssignee.roleNames();
Set<String> permissionStrings = roleAssignee.permissionStrings();
LOG.debug("Found role assignee has the following roles: {}", roleNames);
LOG.debug("Found role assignee has the following permissions: {}", permissionStrings);
SimpleAuthorizationInfo atzInfo = new SimpleAuthorizationInfo(roleNames);
atzInfo.setStringPermissions(permissionStrings);
return atzInfo;
} finally {
uow.discard();
}
}
Aggregations