You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by be...@apache.org on 2014/06/29 21:50:25 UTC
[2/4] git commit: Minor style cleanups and some additional comments.
Minor style cleanups and some additional comments.
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/58cbed14
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/58cbed14
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/58cbed14
Branch: refs/heads/master
Commit: 58cbed14cdbfa4293f4679b2fe5b1613eb193549
Parents: 2cb3761
Author: Benjamin Hindman <be...@gmail.com>
Authored: Sun Jun 29 09:48:58 2014 -0700
Committer: Benjamin Hindman <be...@gmail.com>
Committed: Sun Jun 29 09:48:58 2014 -0700
----------------------------------------------------------------------
include/mesos/mesos.proto | 8 +++++++-
src/credentials/credentials.hpp | 4 ++--
src/master/flags.hpp | 2 +-
src/master/master.cpp | 15 ++++++---------
src/master/master.hpp | 2 --
src/tests/credentials_tests.cpp | 2 --
src/tests/mesos.cpp | 2 +-
7 files changed, 17 insertions(+), 18 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/58cbed14/include/mesos/mesos.proto
----------------------------------------------------------------------
diff --git a/include/mesos/mesos.proto b/include/mesos/mesos.proto
index ddbf55c..6d4fd14 100644
--- a/include/mesos/mesos.proto
+++ b/include/mesos/mesos.proto
@@ -676,11 +676,17 @@ message Credential {
/**
- * Credentials used for authentication
+ * Credentials used for authentication.
*
*/
message Credentials {
+ // Collection of credentials used to authenticate "registration" of
+ // either frameworks or slaves.
repeated Credential registration = 1;
+
+ // Collection of credentails used to authenticate HTTP endpoints
+ // (where the common "username" and "password" are captured as
+ // 'principal' and 'secret' respectively).
repeated Credential http = 2;
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/58cbed14/src/credentials/credentials.hpp
----------------------------------------------------------------------
diff --git a/src/credentials/credentials.hpp b/src/credentials/credentials.hpp
index cb26da9..c446aec 100644
--- a/src/credentials/credentials.hpp
+++ b/src/credentials/credentials.hpp
@@ -71,7 +71,7 @@ inline Result<Credentials> read(const std::string& path)
}
// Add the credential.
- Credential *credential = credentials.add_registration();
+ Credential* credential = credentials.add_registration();
credential->set_principal(pairs[0]);
credential->set_secret(pairs[1]);
}
@@ -101,7 +101,7 @@ inline Result<Credential> readCredential(const std::string& path)
<< "credential file is NOT accessible by others.";
}
- // TODO(ijimenez) deprecate text support only JSON like acls
+ // TODO(ijimenez): Deprecate text support for only JSON ACLs.
Try<JSON::Object> json = JSON::parse<JSON::Object>(read.get());
if (!json.isError()) {
Try<Credential> credential = ::protobuf::parse<Credential>(json.get());
http://git-wip-us.apache.org/repos/asf/mesos/blob/58cbed14/src/master/flags.hpp
----------------------------------------------------------------------
diff --git a/src/master/flags.hpp b/src/master/flags.hpp
index 12c1b33..32704ce 100644
--- a/src/master/flags.hpp
+++ b/src/master/flags.hpp
@@ -232,7 +232,7 @@ public:
" ]\n"
"}\n"
"Text file Example:\n"
- "username:secret\n"
+ "username secret\n"
);
add(&Flags::acls,
http://git-wip-us.apache.org/repos/asf/mesos/blob/58cbed14/src/master/master.cpp
----------------------------------------------------------------------
diff --git a/src/master/master.cpp b/src/master/master.cpp
index a549986..474014b 100644
--- a/src/master/master.cpp
+++ b/src/master/master.cpp
@@ -337,19 +337,16 @@ void Master::initialize()
const string& path =
strings::remove(flags.credentials.get(), "file://", strings::PREFIX);
- Result<Credentials> _credentials = credentials::read(path);
- if (_credentials.isError()) {
- EXIT(1) << _credentials.error() << " (see --credentials flag)";
- } else if (_credentials.isNone()) {
+ Result<Credentials> credentials = credentials::read(path);
+ if (credentials.isError()) {
+ EXIT(1) << credentials.error() << " (see --credentials flag)";
+ } else if (credentials.isNone()) {
EXIT(1) << "Credentials file must contain at least one credential"
<< " (see --credentials flag)";
}
- // Give Authenticator access to credentials.
- sasl::secrets::load(_credentials.get());
-
- // Store credentials in master
- this->credentials = _credentials.get();
+ // Load "registration" credentials into SASL based Authenticator.
+ sasl::secrets::load(credentials.get());
} else if (flags.authenticate_frameworks || flags.authenticate_slaves) {
EXIT(1) << "Authentication requires a credentials file"
http://git-wip-us.apache.org/repos/asf/mesos/blob/58cbed14/src/master/master.hpp
----------------------------------------------------------------------
diff --git a/src/master/master.hpp b/src/master/master.hpp
index 830b538..5fef354 100644
--- a/src/master/master.hpp
+++ b/src/master/master.hpp
@@ -370,8 +370,6 @@ protected:
OfferID newOfferId();
SlaveID newSlaveId();
- Option<Credentials> credentials;
-
private:
// Inner class used to namespace HTTP route handlers (see
// master/http.cpp for implementations).
http://git-wip-us.apache.org/repos/asf/mesos/blob/58cbed14/src/tests/credentials_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/credentials_tests.cpp b/src/tests/credentials_tests.cpp
index 418e02c..c2e2ee7 100644
--- a/src/tests/credentials_tests.cpp
+++ b/src/tests/credentials_tests.cpp
@@ -43,8 +43,6 @@ using mesos::internal::slave::Slave;
using process::PID;
using testing::_;
-using testing::Eq;
-using testing::Return;
class CredentialsTest : public MesosTest {};
http://git-wip-us.apache.org/repos/asf/mesos/blob/58cbed14/src/tests/mesos.cpp
----------------------------------------------------------------------
diff --git a/src/tests/mesos.cpp b/src/tests/mesos.cpp
index 131d18b..0d7f335 100644
--- a/src/tests/mesos.cpp
+++ b/src/tests/mesos.cpp
@@ -93,7 +93,7 @@ master::Flags MesosTest::CreateMasterFlags()
// JSON default format for credentials
Credentials credentials;
- Credential *credential = credentials.add_registration();
+ Credential* credential = credentials.add_registration();
credential->set_principal(DEFAULT_CREDENTIAL.principal());
credential->set_secret(DEFAULT_CREDENTIAL.secret());
credential = credentials.add_http();