if(exchange != null) {
exchange.putAttachment(UndertowSecurityAttachments.SECURITY_CONTEXT_ATTACHMENT, sc);
}
}
SecurityActions.setSecurityContextOnAssociation(sc);
final MappingManager mappingManager = securityDomainContext.getMappingManager();
if (mappingManager != null) {
if(WildFlySecurityManager.isChecking()) {
WildFlySecurityManager.doUnchecked(new PrivilegedAction<Object>() {
@Override
public Object run() {
// if there are mapping modules let them handle the role mapping
MappingContext<RoleGroup> mc = mappingManager.getMappingContext(MappingType.ROLE.name());
if (mc != null && mc.hasModules()) {
SecurityRolesAssociation.setSecurityRoles(principleVsRoleMap);
}
return null;
}
});
} else {
// if there are mapping modules let them handle the role mapping
MappingContext<RoleGroup> mc = mappingManager.getMappingContext(MappingType.ROLE.name());
if (mc != null && mc.hasModules()) {
SecurityRolesAssociation.setSecurityRoles(principleVsRoleMap);
}
}
}