class RestAuthHttpCallbackHandler extends AbstractRestAuthCallbackHandler<HttpCallback> {

    public HttpCallback handle(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;
    }

}