throw new IllegalArgumentException("ContextID is null");
if(callerSubject == null)
throw new IllegalArgumentException("callerSubject is null");
AuthorizationManager authzMgr = securityContext.getAuthorizationManager();
if(authzMgr == null)
throw new IllegalStateException("Authorization Manager is null");
boolean hasTheRole = false;
Map<String,Object> map = new HashMap<String,Object>();
map.put(ResourceKeys.ROLENAME, roleName);
map.put(ResourceKeys.ROLEREF_PERM_CHECK, Boolean.TRUE);
map.put(ResourceKeys.PRINCIPAL_ROLES, principalRoles);
map.put(ResourceKeys.POLICY_REGISTRATION, getPolicyRegistration());
WebResource webResource = new WebResource(Collections.unmodifiableMap(map));
webResource.setPolicyContextID(contextID);
webResource.setPrincipal(principal);
webResource.setServletName(servletName);
webResource.setCallerSubject(callerSubject);
SecurityContextCallbackHandler sch = new SecurityContextCallbackHandler(this.securityContext);
RoleGroup callerRoles = authzMgr.getSubjectRoles(callerSubject, sch);
try
{
int permit = authzMgr.authorize(webResource, callerSubject, callerRoles);
hasTheRole = (permit == AuthorizationContext.PERMIT);
String level = (hasTheRole ? AuditLevel.SUCCESS : AuditLevel.FAILURE);
if(this.enableAudit)
this.authorizationAudit(level,webResource, null);
}