public Principal authenticate(Request request, HttpServletResponse response,
LoginConfig config) throws Exception
{
log.debug("ExtendedSecurityMgrRealm:authenticate");
MessageInfo authParam = new GenericMessageInfo(request, request.getResponse());
GeneralizedAuthenticationManager gam = getAuthenticationManager();
Subject clientSubject = new Subject();
Subject serviceSubject = new Subject();
Map sharedState = getSharedState(request,config);
AuthStatus status = AuthStatus.FAILURE;
while(!status.equals(AuthStatus.SEND_CONTINUE))
{
status = gam.validateRequest(authParam, clientSubject, serviceSubject);
if(status.equals(AuthStatus.FAILURE))
throw new SecurityException("Authentication failed");
}
Principal authenticatedPrincipal = this.getAuthenticatedPrincipal(clientSubject);
return null;