cp = inv.invocationInfo.cachedPermission;
ejbmp = cp.getPermission();
}
String caller = null;
SecurityContext sc = null;
pcHandlerImpl.getHandlerData().setInvocation(inv);
ret = cp.checkPermission();
if (!ret) {
sc = SecurityContext.getCurrent();
Set principalSet = sc.getPrincipalSet();
ProtectionDomain prdm = getCachedProtectionDomain(principalSet,true);
try {
// set the policy context in the TLS.
String oldContextId = setPolicyContext(this.contextId);
try {
ret = policy.implies(prdm, ejbmp);
} catch (SecurityException se){
_logger.log(Level.SEVERE,"JACC: Unexpected security exception on access decision",se);
ret = false;
} catch (Throwable t) {
_logger.log(Level.SEVERE,"JACC: Unexpected exception on access decision",t);
ret = false;
} finally {
resetPolicyContext(oldContextId,this.contextId);
}
} catch (Throwable t) {
_logger.log(Level.SEVERE,"JACC: Unexpected exception manipulating policy context",t);
ret = false;
}
}
inv.auth = (ret) ? Boolean.TRUE : Boolean.FALSE;
if (auditManager.isAuditOn()){
if (sc == null) {
sc = SecurityContext.getCurrent();
}
caller = sc.getCallerPrincipal().getName();
auditManager.ejbInvocation(caller, ejbName, inv.method.toString(), ret);
}
if (ret && inv.isWebService && !inv.preInvokeDone) {
preInvoke(inv);