throws GeneralSecurityException
{
Principal caller = context.getCallerPrincipal();
String name = caller.getName();
if( name.equals(callerName) == false )
throw new GeneralSecurityException("CallerPrincipal.name("+name+") != "+callerName);
validatePolicyContextSubject("enter", callerPrincipals);
validateSecurityAssociationSubject("enter", callerPrincipals);
InitialContext ctx = null;
try
{
ctx = new InitialContext();
StatelessSessionHome home = (StatelessSessionHome)
ctx.lookup("java:comp/env/ejb/StatelessSession");
StatelessSession bean = home.create();
bean.echo("validateCallerContext");
validatePolicyContextSubject("post stateless", callerPrincipals);
validateSecurityAssociationSubject("post stateless", callerPrincipals);
StatefulSessionHome home2 = (StatefulSessionHome)
ctx.lookup("java:comp/env/ejb/StatefulSession");
StatefulSession bean2 = home2.create("validateCallerContext");
bean2.echo("validateCallerContext");
validatePolicyContextSubject("post stateful", callerPrincipals);
validateSecurityAssociationSubject("post stateful", callerPrincipals);
EntityHome home3 = (EntityHome)
ctx.lookup("java:comp/env/ejb/Entity");
Entity bean3 = null;
try
{
bean3 = home3.findByPrimaryKey("validateCallerContext");
}
catch(FinderException e)
{
bean3 = home3.create("validateCallerContext");
}
bean3.echo("validateCallerContext");
}
catch(Exception e)
{
GeneralSecurityException ex = new GeneralSecurityException("Unexpected exception");
ex.initCause(e);
throw ex;
}
validatePolicyContextSubject("exit", callerPrincipals);
validateSecurityAssociationSubject("exit", callerPrincipals);
}