// Specify the login conf file location
String authConf = super.getResourceURL("security/auth.conf");
getLog().debug("Using auth.conf: "+authConf);
System.setProperty("java.security.auth.login.config", authConf);
AppCallbackHandler handler = new AppCallbackHandler("admin", "admin".toCharArray());
LoginContext lc = new LoginContext("testSecureHttpInvoker", handler);
lc.login();
// Test the secured JNDI factory
env.setProperty(Context.PROVIDER_URL, INVOKER_BASE + "restricted/JNDIFactory");
getLog().debug("Creating InitialContext with env="+env);
InitialContext ctx = new InitialContext(env);
getLog().debug("Created InitialContext");
Object obj = ctx.lookup("jmx");
getLog().debug("lookup(jmx) : "+obj);
Context jmxCtx = (Context) obj;
NamingEnumeration list = jmxCtx.list("");
while( list.hasMore() )
{
Object entry = list.next();
getLog().debug(" + "+entry);
}
ctx.close();
lc.logout();
Principal p = SecurityAssociation.getPrincipal();
assertTrue("SecurityAssociation.getPrincipal is null", p == null);
/* This is now failing because we don't appear to have anyway to flush