if (request.getDispatcherType() != DispatcherType.REQUEST) {
next.handleRequest(exchange);
} else if (constraints == null || constraints.isEmpty()) {
next.handleRequest(exchange);
} else {
Account account = sc.getAuthenticatedAccount();
for (final SingleConstraintMatch constraint : constraints) {
boolean found = false;
Set<String> roleSet = constraint.getRequiredRoles();
if (roleSet.isEmpty() && constraint.getEmptyRoleSemantic() != SecurityInfo.EmptyRoleSemantic.DENY) {
/*
* The EmptyRoleSemantic was either PERMIT or AUTHENTICATE, either way a roles check is not needed.
*/
found = true;
} else if(account != null) {
final Set<String> roles = principalVsRoleMap.get(account.getPrincipal().getName());
for (String role : roleSet) {
if(roles != null) {
if(roles.contains(role)) {
found = true;
break;
}
}
if (account.getRoles().contains(role)) {
found = true;
break;
}
}
}