Authorize the caller's access to the method invocation
String contextID = (String) mi.getMetaData(JACC, CTX);
SecurityActions.setContextID(contextID);
//EJBArgsPolicyContextHandler.setArgs(mi.getArguments());
//Set custom JACC policy handlers - Following used in EJB 2, but just seems to be ignored
//BeanMetaDataPolicyContextHandler.setMetaData(null);
Method m = mi.getMethod();
InvokerLocator locator = (InvokerLocator) mi.getMetaData(InvokeRemoteInterceptor.REMOTING, InvokeRemoteInterceptor.INVOKER_LOCATOR);
String iface = (locator != null) ? "Remote" : "Local";
EJBMethodPermission methodPerm = new EJBMethodPermission(ejbName, iface, m);
if(realmMapping != null)
{
JaccHelper.checkPermission(ejbCS, methodPerm,realmMapping);
}
/*// Get the caller
Subject caller = SecurityActions.getContextSubject();
Principal[] principals = null;
if( caller != null )
{
// Get the caller principals
Set principalsSet = caller.getPrincipals();
principals = new Principal[principalsSet.size()];
principalsSet.toArray(principals);
}
ProtectionDomain pd = new ProtectionDomain (ejbCS, null, null, principals);
if( policy.implies(pd, methodPerm) == false )
{
String msg = "Denied: "+methodPerm+", caller=" + caller;
SecurityException e = new SecurityException(msg);
throw e;
}*/