You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ti...@apache.org on 2016/06/20 13:59:56 UTC

[3/5] mesos git commit: Updated the HTTP result returned by failures of authn/authz.

Updated the HTTP result returned by failures of authn/authz.

Changes authentication and authorization happening on the libprocess
level to be in line with failures possibly returned by Mesos
authorization as currently implemented by the HTTPProxy::process
function. The HTTP result returned on failures has changed from
InternalServerError (500) towards ServiceNotAvailable (503) and now
contains a message describing the problem.

Review: https://reviews.apache.org/r/48920/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/56a49b28
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/56a49b28
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/56a49b28

Branch: refs/heads/master
Commit: 56a49b28596c263dd3f17d948bbb2ad2f7177ec8
Parents: bb95476
Author: Till Toenshoff <to...@me.com>
Authored: Mon Jun 20 15:58:21 2016 +0200
Committer: Till Toenshoff <to...@me.com>
Committed: Mon Jun 20 15:58:21 2016 +0200

----------------------------------------------------------------------
 3rdparty/libprocess/src/process.cpp | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/56a49b28/3rdparty/libprocess/src/process.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/process.cpp b/3rdparty/libprocess/src/process.cpp
index 1cb2866..4a9b1ff 100644
--- a/3rdparty/libprocess/src/process.cpp
+++ b/3rdparty/libprocess/src/process.cpp
@@ -3332,7 +3332,10 @@ void ProcessBase::visit(const HttpEvent& event)
       .onAny(defer(self(), [this, endpoint, request, response, name, id](
           const Future<Option<AuthenticationResult>>& authentication) {
         if (!authentication.isReady()) {
-          response->set(InternalServerError());
+          response->set(
+              authentication.isFailed()
+                ? ServiceUnavailable(authentication.failure())
+                : ServiceUnavailable());
 
           VLOG(1) << "Returning '" << response->future()->status << "'"
                   << " for '" << request.url.path << "'"
@@ -3391,7 +3394,10 @@ void ProcessBase::visit(const HttpEvent& event)
           .onAny(defer(self(), [endpoint, request, response, principal](
               const Future<bool>& authorization) {
             if (!authorization.isReady()) {
-              response->set(InternalServerError());
+              response->set(
+                  authorization.isFailed()
+                    ? ServiceUnavailable(authorization.failure())
+                    : ServiceUnavailable());
 
               VLOG(1) << "Returning '" << response->future()->status << "'"
                       << " for '" << request.url.path << "'"