Map<String, Object> map = new HashMap<String, Object>();
map.put("securityConstraints", constraints);
map.put(ResourceKeys.USERDATA_PERM_CHECK, Boolean.TRUE);
SecurityContext sc = SecurityActions.getSecurityContext();
AbstractWebAuthorizationHelper helper = null;
try {
helper = SecurityHelperFactory.getWebAuthorizationHelper(sc);
} catch (Exception e) {
UndertowLogger.ROOT_LOGGER.noAuthorizationHelper(e);
return false;
}
Subject callerSubject = sc.getUtil().getSubject();
// JBAS-6419:CallerSubject has no bearing on the user data permission check
if (callerSubject == null) {
callerSubject = new Subject();
}
ArrayList<String> roles = new ArrayList<String>();
if(account != null) {
roles.addAll(account.getRoles());
}
boolean ok = helper.hasUserDataPermission(map, request, response, PolicyContext.getContextID(), callerSubject,
roles);
//If the status of the response has already been changed (it is different from the default Response.SC_OK) we should not attempt to change it.
if (!ok && response.getStatus() == HttpServletResponse.SC_OK) {
try {