if (violatedPermission instanceof NamedDomainPermission) {
NamedDomainPermission namedPermission = (NamedDomainPermission) violatedPermission;
permissionInfo = "Permission " + namedPermission.getName();
}
if (violatedPermission instanceof NamedApplicationRole) {
NamedApplicationRole namedRole = (NamedApplicationRole) violatedPermission;
permissionInfo = "Role " + namedRole.getRoleName();
}
return new BasicAuthorizationViolation(permissionInfo, getExceptionPointInfo(invocationContext));
}