@Test public void itSendsABAHeaderWhenNoExcludeHeaderIsSet() throws Exception { HttpServletRequest req = mock(HttpServletRequest.class); HttpServletResponse resp = mock(HttpServletResponse.class); ba.handleLoginPrompt(req, resp, "/"); verify(resp).addHeader(eq(BasicAuthenticator.BA_HEADER_NAME), anyString()); }
@Override public Boolean handleLoginPrompt(HttpServletRequest httpRequest, HttpServletResponse httpResponse, String baseURL) { try { if (needToAddBAHeader(httpRequest)) { String baHeader = "Basic realm=\"" + realName + '\"'; httpResponse.addHeader(BA_HEADER_NAME, baHeader); } int statusCode; Integer requestStatusCode = (Integer) httpRequest.getAttribute(NXAuthConstants.LOGIN_STATUS_CODE); if (requestStatusCode != null) { statusCode = requestStatusCode; } else { statusCode = HttpServletResponse.SC_UNAUTHORIZED; } httpResponse.sendError(statusCode); return true; } catch (IOException e) { return false; } }
BasicAuthenticator implements NuxeoAuthenticationPlugin { @Override public Boolean handleLoginPrompt(HttpServletRequest httpRequest, HttpServletResponse httpResponse, String baseURL) { try { if (needToAddBAHeader(httpRequest)) { String baHeader = "Basic realm=\"" + realName + '\"'; httpResponse.addHeader(BA_HEADER_NAME, baHeader); } int statusCode; Integer requestStatusCode = (Integer) httpRequest.getAttribute(NXAuthConstants.LOGIN_STATUS_CODE); if (requestStatusCode != null) { statusCode = requestStatusCode; } else { statusCode = HttpServletResponse.SC_UNAUTHORIZED; } httpResponse.sendError(statusCode); return true; } catch (IOException e) { return false; } } }
BasicAuthenticator implements NuxeoAuthenticationPlugin { @Override public Boolean handleLoginPrompt(HttpServletRequest httpRequest, HttpServletResponse httpResponse, String baseURL) { try { if (needToAddBAHeader(httpRequest)) { String baHeader = "Basic realm=\"" + realName + '\"'; httpResponse.addHeader(BA_HEADER_NAME, baHeader); } int statusCode; Integer requestStatusCode = (Integer) httpRequest.getAttribute(NXAuthConstants.LOGIN_STATUS_CODE); if (requestStatusCode != null) { statusCode = requestStatusCode; } else { statusCode = HttpServletResponse.SC_UNAUTHORIZED; } httpResponse.sendError(statusCode); return true; } catch (IOException e) { return false; } }  }
BasicAuthenticator implements NuxeoAuthenticationPlugin { @Override public Boolean handleLoginPrompt(HttpServletRequest httpRequest, HttpServletResponse httpResponse, String baseURL) { try { if (needToAddBAHeader(httpRequest)) { String baHeader = "Basic realm=\"" + realName + '\"'; httpResponse.addHeader(BA_HEADER_NAME, baHeader); } int statusCode; Integer requestStatusCode = (Integer) httpRequest.getAttribute(NXAuthConstants.LOGIN_STATUS_CODE); if (requestStatusCode != null) { statusCode = requestStatusCode; } else { statusCode = HttpServletResponse.SC_UNAUTHORIZED; } httpResponse.sendError(statusCode); return true; } catch (IOException e) { return false; } }  @Override Boolean handleLoginPrompt(HttpServletRequest httpRequest, HttpServletResponse httpResponse, String baseURL); @Override UserIdentificationInfo handleRetrieveIdentity(HttpServletRequest httpRequest,
            HttpServletResponse httpResponse); @Override Boolean needLoginPrompt(HttpServletRequest httpRequest); @Override void initPlugin(Map<String, String> parameters); @Override List<String> getUnAuthenticatedURLPrefix(); }
BasicAuthenticator implements NuxeoAuthenticationPlugin { @Override public Boolean handleLoginPrompt(HttpServletRequest httpRequest, HttpServletResponse httpResponse, String baseURL) { try { if (needToAddBAHeader(httpRequest)) { String baHeader = "Basic realm=\"" + realName + '\"'; httpResponse.addHeader(BA_HEADER_NAME, baHeader); } int statusCode; Integer requestStatusCode = (Integer) httpRequest.getAttribute(NXAuthConstants.LOGIN_STATUS_CODE); if (requestStatusCode != null) { statusCode = requestStatusCode; } else { statusCode = HttpServletResponse.SC_UNAUTHORIZED; } httpResponse.sendError(statusCode); return true; } catch (IOException e) { return false; } }  @Override Boolean handleLoginPrompt(HttpServletRequest httpRequest, HttpServletResponse httpResponse, String baseURL); @Override UserIdentificationInfo handleRetrieveIdentity(HttpServletRequest httpRequest,
            HttpServletResponse httpResponse); @Override Boolean needLoginPrompt(HttpServletRequest httpRequest); @Override void initPlugin(Map<String, String> parameters); @Override List<String> getUnAuthenticatedURLPrefix();  }