// Set the config url to the security/auth.conf resource
ClassLoader loader = Thread.currentThread().getContextClassLoader();
URL authURL = loader.getResource("security/auth.conf");
System.setProperty("java.security.auth.login.config", authURL.toString());
}
AppCallbackHandler handler = new AppCallbackHandler(username, password);
log.debug("Creating LoginContext("+confName+")");
LoginContext lc = new LoginContext(confName, handler);
lc.login();
log.debug("Created LoginContext, subject="+lc.getSubject());
return lc;