Subject subject = null;
Subject authenticatedSubject = null;
// Perform user authentication
LDAPRealmAuthenticationPolicy authenticationPolicy = authenticationPolicies.get(0);
if( authenticationPolicy != null) {
subject = HttpSecurityUtil.getSubject(msg);
CallbackHandler callbackHandler = new LDAPRealmAuthenticationCallbackHandler(subject);
/* Uses Geronimo to login */
LoginContext geronimoLoginContext = ContextManager.login(authenticationPolicy.getRealmConfigurationName(), callbackHandler);
authenticatedSubject = geronimoLoginContext.getSubject();
ContextManager.setCallers(authenticatedSubject, authenticatedSubject);
if (authenticatedSubject != null) {
//TODO: add authenticated subject to the msg header ?