{
String password = extractPassword(credentials);
if (password != null)
{
ContextManager contextManager = ContextManagerFactory.getInstance();
Subject subject =
contextManager.login(contextManager.getDefaultRealm(),
username, password);
if (subject != null)
{
//setting the caller subject really doesn't apply for long
//it appears to be removed later as each call to
//ContextManagerFactory.getInstance()
//returns a new instance and we cannot get the real context
//and assign values that will be re-used.
//this also means that the HttpServletRequest will not have the
//information that we've assigned, hence we store this contextManager
//in the Principal for later use
contextManager.setCallerSubject(subject);
principal = new WSLCPrincipal(username, contextManager, subject);
}
}
}
catch (WSLoginFailedException wsLoginFailedException)