*/
public Object invoke(Invocation invocation) throws Throwable
{
SecurityContext previousSC = null;
String type = invocation.getType();
Subject subject = null;
if (!initialized)
initialize();
if (type == Invocation.OP_INVOKE && securityMgr != null)
{
String opName = invocation.getName();
if (opName.equals("invoke"))
{
Object[] args = invocation.getArgs();
org.jboss.invocation.Invocation inv = (org.jboss.invocation.Invocation) args[0];
// Authenticate the caller based on the security association
Principal caller = inv.getPrincipal();
Object credential = inv.getCredential();
subject = new Subject();
boolean isValid = securityMgr.isValid(caller, credential, subject);
if (isValid == false)
{
String msg = "Failed to authenticate principal=" + caller + ", securityDomain="
+ securityMgr.getSecurityDomain();