@Test public void shouldHandleCallbackWhereIWASuccessful() { HttpHeaders headers = mock(HttpHeaders.class); HttpServletRequest request = mock(HttpServletRequest.class); HttpServletResponse response = mock(HttpServletResponse.class); JsonValue jsonPostBody = new JsonValue(new HashMap<String, String>()); HttpCallback originalHttpCallback = mock(HttpCallback.class); HttpCallback httpCallback = restAuthHttpCallbackHandler.handle(headers, request, response, jsonPostBody, originalHttpCallback); assertEquals(originalHttpCallback, httpCallback); verify(request, never()).setAttribute("http-auth-failed", true); }
public HttpCallback handle(HttpHeaders headers, HttpServletRequest request, HttpServletResponse response, JsonValue postBody, HttpCallback originalCallback) { if (isJsonAttributePresent(postBody, "reason") && postBody.get("reason").asString().equals(HTTP_AUTH_FAILED)) { request.setAttribute(HTTP_AUTH_FAILED, true); } return originalCallback; }
RestAuthHttpCallbackHandler extends AbstractRestAuthCallbackHandler<HttpCallback> { public HttpCallback handle(HttpHeaders headers, HttpServletRequest request, HttpServletResponse response, JsonValue postBody, HttpCallback originalCallback) { if (isJsonAttributePresent(postBody, "reason") && postBody.get("reason").asString().equals(HTTP_AUTH_FAILED)) { request.setAttribute(HTTP_AUTH_FAILED, true); } return originalCallback; } }
RestAuthHttpCallbackHandler extends AbstractRestAuthCallbackHandler<HttpCallback> { public HttpCallback handle(HttpHeaders headers, HttpServletRequest request, HttpServletResponse response, JsonValue postBody, HttpCallback originalCallback) { if (isJsonAttributePresent(postBody, "reason") && postBody.get("reason").asString().equals(HTTP_AUTH_FAILED)) { request.setAttribute(HTTP_AUTH_FAILED, true); } return originalCallback; }  }
RestAuthHttpCallbackHandler extends AbstractRestAuthCallbackHandler<HttpCallback> { public HttpCallback handle(HttpHeaders headers, HttpServletRequest request, HttpServletResponse response, JsonValue postBody, HttpCallback originalCallback) { if (isJsonAttributePresent(postBody, "reason") && postBody.get("reason").asString().equals(HTTP_AUTH_FAILED)) { request.setAttribute(HTTP_AUTH_FAILED, true); } return originalCallback; }  boolean updateCallbackFromRequest(HttpHeaders headers, HttpServletRequest request,
            HttpServletResponse response, HttpCallback callback); HttpCallback handle(HttpHeaders headers, HttpServletRequest request, HttpServletResponse response,
            JsonValue postBody, HttpCallback originalCallback); String getCallbackClassName(); JsonValue convertToJson(HttpCallback callback, int index); HttpCallback convertFromJson(HttpCallback callback, JsonValue jsonCallback); }
RestAuthHttpCallbackHandler extends AbstractRestAuthCallbackHandler<HttpCallback> { public HttpCallback handle(HttpHeaders headers, HttpServletRequest request, HttpServletResponse response, JsonValue postBody, HttpCallback originalCallback) { if (isJsonAttributePresent(postBody, "reason") && postBody.get("reason").asString().equals(HTTP_AUTH_FAILED)) { request.setAttribute(HTTP_AUTH_FAILED, true); } return originalCallback; }  boolean updateCallbackFromRequest(HttpHeaders headers, HttpServletRequest request,
            HttpServletResponse response, HttpCallback callback); HttpCallback handle(HttpHeaders headers, HttpServletRequest request, HttpServletResponse response,
            JsonValue postBody, HttpCallback originalCallback); String getCallbackClassName(); JsonValue convertToJson(HttpCallback callback, int index); HttpCallback convertFromJson(HttpCallback callback, JsonValue jsonCallback);  }