Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OAuth2-based Macaroon acquisition #883

Merged
merged 9 commits into from Jan 11, 2019
6 changes: 3 additions & 3 deletions src/XrdMacaroons/XrdMacaroonsHandler.cc
Expand Up @@ -160,7 +160,7 @@ Handler::MatchesPath(const char *verb, const char *path)
int Handler::ProcessOAuthConfig(XrdHttpExtReq &req) {
if (req.verb != "GET")
{
return req.SendSimpleResp(400, NULL, NULL, "Only GET is valid for oauth config.", 0);
return req.SendSimpleResp(405, NULL, NULL, "Only GET is valid for oauth config.", 0);
}
auto header = req.headers.find("Host");
if (header == req.headers.end())
Expand Down Expand Up @@ -193,7 +193,7 @@ int Handler::ProcessTokenRequest(XrdHttpExtReq &req)
{
if (req.verb != "POST")
{
return req.SendSimpleResp(400, NULL, NULL, "Only POST is valid for token request.", 0);
return req.SendSimpleResp(405, NULL, NULL, "Only POST is valid for token request.", 0);
}
auto header = req.headers.find("Content-Type");
if (header == req.headers.end())
Expand Down Expand Up @@ -519,7 +519,7 @@ Handler::GenerateMacaroonResponse(XrdHttpExtReq &req, const std::string &resourc
{
return req.SendSimpleResp(500, NULL, NULL, "Unable to create a new JSON validity object.", 0);
}
json_object_object_add(response_obj, "expire_in", expire_in_obj);
json_object_object_add(response_obj, "expires_in", expire_in_obj);

const char *macaroon_result = json_object_to_json_string_ext(response_obj, JSON_C_TO_STRING_PRETTY);
int retval = req.SendSimpleResp(200, NULL, NULL, macaroon_result, 0);
Expand Down