Repository: mesos
Updated Branches:
  refs/heads/master 1de39e676 -> 02c7083af


Added support for auth tokens to the V1 executor library.

This patch adds support for authentication tokens to the
V1 default executor library. The tokens are loaded from a
pre-determined environment variable, if present.

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


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

Branch: refs/heads/master
Commit: dfdd9bde5f67861a19083d0a173e683ec569fb63
Parents: 1de39e6
Author: Greg Mann <[email protected]>
Authored: Sat Mar 25 12:04:11 2017 -0700
Committer: Anand Mazumdar <[email protected]>
Committed: Sat Mar 25 12:04:11 2017 -0700

----------------------------------------------------------------------
 src/executor/executor.cpp | 10 ++++++++++
 1 file changed, 10 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/dfdd9bde/src/executor/executor.cpp
----------------------------------------------------------------------
diff --git a/src/executor/executor.cpp b/src/executor/executor.cpp
index 35378ec..9c14054 100644
--- a/src/executor/executor.cpp
+++ b/src/executor/executor.cpp
@@ -223,6 +223,11 @@ public:
         upid.id +
         "/api/v1/executor");
 
+    value = os::getenv("MESOS_EXECUTOR_AUTHENTICATION_TOKEN");
+    if (value.isSome()) {
+      authenticationToken = value.get();
+    }
+
     // Get checkpointing status from environment.
     value = os::getenv("MESOS_CHECKPOINT");
     checkpoint = value.isSome() && value.get() == "1";
@@ -309,6 +314,10 @@ public:
     request.headers = {{"Accept", stringify(contentType)},
                        {"Content-Type", stringify(contentType)}};
 
+    if (authenticationToken.isSome()) {
+      request.headers["Authorization"] = "Bearer " + authenticationToken.get();
+    }
+
     CHECK_SOME(connections);
 
     Future<Response> response;
@@ -811,6 +820,7 @@ private:
   Option<Duration> maxBackoff;
   Option<Timer> recoveryTimer;
   Duration shutdownGracePeriod;
+  Option<string> authenticationToken;
 };
 
 

Reply via email to