class RestAuthHttpCallbackHandler extends AbstractRestAuthCallbackHandler<HttpCallback> {

    public boolean updateCallbackFromRequest(HttpServletRequest request, HttpServletResponse response,
            HttpCallback callback) throws RestAuthResponseException {

        String httpAuthorization = request.getHeader(callback.getAuthorizationHeader());

        if (httpAuthorization == null || "".equals(httpAuthorization)) {
            DEBUG.message("Authorization Header not set in request.");

            JsonValue jsonValue = JsonValueBuilder.jsonValue()
                    .put("failure", true)
                    .put("reason", HTTP_AUTH_FAILED)
                    .build();
            Map<String, String> responseHeaders = new HashMap<String, String>();
            responseHeaders.put(callback.getNegotiationHeaderName(), callback.getNegotiationHeaderValue());
            throw new RestAuthResponseException(RestAuthException.UNAUTHORIZED, responseHeaders, jsonValue);
        }

        callback.setAuthorization(httpAuthorization);
        return true;
    }

}