assertEquals(AuthorizationContext.DENY, res);
}
public void testEJBContextIsCallerInRoleValid() throws Exception
{
EJBXACMLPolicyModuleDelegate pc = new EJBXACMLPolicyModuleDelegate();
PolicyRegistration policyRegistration = new JBossPolicyRegistration();
registerPolicy(policyRegistration);
EJBResource er = getEJBResource(policyRegistration);
er.setPolicyContextID(contextID);
er.setPrincipal(new SimplePrincipal("baduser"));
er.getMap().put(ResourceKeys.ROLEREF_PERM_CHECK, true);
er.getMap().put(ResourceKeys.ROLENAME, "employee");
Set<SecurityRoleRef> roleRefSet = new HashSet<SecurityRoleRef>();
roleRefSet.add(this.getSecurityRoleRef("employee", "ProjectUser"));
er.setSecurityRoleReferences(roleRefSet);
int res = pc.authorize(er, new Subject(), getRoleGroup());
assertEquals(AuthorizationContext.PERMIT, res);
}