Source:
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String commonAuthURL = IdentityUtil.getServerURL(IWAConstants.COMMON_AUTH_EP, false, true); String param = request.getParameter(IWAConstants.IWA_PARAM_STATE); String name; if (param == null) { throw new IllegalArgumentException(IWAConstants.IWA_PARAM_STATE + " parameter is null."); } commonAuthURL += "?" + IWAConstants.IWA_PARAM_STATE + "=" + URLEncoder.encode(param, IWAConstants.UTF_8) + "&" + IWAAuthenticator.IWA_PROCESSED + "=1"; String header = request.getHeader(IWAConstants.AUTHORIZATION_HEADER); if (this.isLocalhost(request)) { name = AuthenticationHandler.doLocalhost(); } else if (header != null) { String token = header.substring(IWAConstants.NEGOTIATE_HEADER.length()+1); if (token.startsWith(IWAConstants.NTLM_PROLOG)){ log.warn("NTLM token found."); response.sendRedirect(commonAuthURL); return; } final byte gssToken = Base64.decode(token); try { name = AuthenticationHandler.processToken(gssToken); } catch (GSSException e) { log.warn("error logging in user.", e); response.sendRedirect(commonAuthURL); return; } if (name.equals(null)) { log.warn("error logging in user."); response.sendRedirect(commonAuthURL); return; } } else { if (log.isDebugEnabled()) { log.debug("authorization required"); } sendUnauthorized(response, false); return; } if (log.isDebugEnabled()) { log.debug("logged in user: " + name ); } HttpSession session = request.getSession(true); if (session == null) { throw new ServletException("Expected HttpSession"); } session.setAttribute(IWAConstants.SUBJECT_ATTRIBUTE, name); log.info("Successfully logged in user: " + name); response.sendRedirect(commonAuthURL); }

Target:
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String commonAuthURL = IdentityUtil.getServerURL(IWAConstants.COMMON_AUTH_EP, false, true); String param = request.getParameter(IWAConstants.IWA_PARAM_STATE); String name; if (param == null) { throw new IllegalArgumentException(IWAConstants.IWA_PARAM_STATE + " parameter is null."); } commonAuthURL += "?" + IWAConstants.IWA_PARAM_STATE + "=" + URLEncoder.encode(param, IWAConstants.UTF_8) + "&" + IWAAuthenticator.IWA_PROCESSED + "=1"; String header = request.getHeader(IWAConstants.AUTHORIZATION_HEADER); if (this.isLocalhost(request)) { name = AuthenticationHandlerUtil.doLocalhost(); } else if (header != null) { String token = header.substring(IWAConstants.NEGOTIATE_HEADER.length() + 1); if (token.startsWith(IWAConstants.NTLM_PROLOG)) { log.warn("NTLM token found."); response.sendRedirect(commonAuthURL); return; } final byte[] gssToken = Base64.decode(token); try { name = AuthenticationHandlerUtil.processToken(gssToken); } catch (GSSException e) { log.warn("error logging in user.", e); response.sendRedirect(commonAuthURL); return; } if (name == null) { log.warn("error logging in user."); response.sendRedirect(commonAuthURL); return; } } else { if (log.isDebugEnabled()) { log.debug("authorization required"); } sendUnauthorized(response, false); return; } if (log.isDebugEnabled()) { log.debug("logged in user: " + name); } HttpSession session = request.getSession(true); if (session == null) { throw new ServletException("Expected HttpSession"); } session.setAttribute(IWAConstants.SUBJECT_ATTRIBUTE, name); log.info("Successfully logged in user: " + name); response.sendRedirect(commonAuthURL); }