throws IOException, ServletException {
final HttpServletRequest httpRequest = (HttpServletRequest) request;
final HttpServletResponse httpResponse = new HttpServletResponseWrapper((HttpServletResponse) rawResponse);
final SecurityContext context = securityManager.newSecurityContext( httpRequest, httpResponse );
try {
logout( context, httpRequest, httpResponse );
authenticate( context, httpResponse );