Fully qualified the Authenticator class in common/http.cpp.

When building with precompiled headers, the libprocess-level
Authenticator has a namespace resolution conflict with the Mesos-level
Authenticator:
* `process::http::authentication::Authenticator`
* `mesos::Authenticator`

In common/http.cpp, the functions are in the `mesos` namespace,
so the (incorrect) Mesos-level Authenticator is pulled in first,
resulting in compilation issues with precompiled headers.


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

Branch: refs/heads/master
Commit: 5b12abb01bf24c2badddb34768494f92b942d497
Parents: c32977b
Author: Joseph Wu <[email protected]>
Authored: Wed Mar 29 12:26:41 2017 -0700
Committer: Joseph Wu <[email protected]>
Committed: Wed Mar 29 13:38:22 2017 -0700

----------------------------------------------------------------------
 src/common/http.cpp | 32 ++++++++++++++++++++------------
 1 file changed, 20 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/5b12abb0/src/common/http.cpp
----------------------------------------------------------------------
diff --git a/src/common/http.cpp b/src/common/http.cpp
index 98750a0..89133e0 100644
--- a/src/common/http.cpp
+++ b/src/common/http.cpp
@@ -60,7 +60,6 @@ using std::vector;
 using process::Failure;
 using process::Owned;
 
-using process::http::authentication::Authenticator;
 #ifdef USE_SSL_SOCKET
 using process::http::authentication::JWTAuthenticator;
 #endif // USE_SSL_SOCKET
@@ -961,7 +960,7 @@ bool approveViewRole(
 
 namespace {
 
-Result<Authenticator*> createBasicAuthenticator(
+Result<process::http::authentication::Authenticator*> createBasicAuthenticator(
     const string& realm,
     const string& authenticatorName,
     const Option<Credentials>& credentials)
@@ -982,7 +981,7 @@ Result<Authenticator*> createBasicAuthenticator(
 
 
 #ifdef USE_SSL_SOCKET
-Result<Authenticator*> createJWTAuthenticator(
+Result<process::http::authentication::Authenticator*> createJWTAuthenticator(
     const string& realm,
     const string& authenticatorName,
     const Option<string>& secretKey)
@@ -1003,11 +1002,12 @@ Result<Authenticator*> createJWTAuthenticator(
 #endif // USE_SSL_SOCKET
 
 
-Result<Authenticator*> createCustomAuthenticator(
+Result<process::http::authentication::Authenticator*> 
createCustomAuthenticator(
     const string& realm,
     const string& authenticatorName)
 {
-  if (!modules::ModuleManager::contains<Authenticator>(authenticatorName)) {
+  if (!modules::ModuleManager::contains<
+        process::http::authentication::Authenticator>(authenticatorName)) {
     return Error(
         "HTTP authenticator '" + authenticatorName + "' not found. "
         "Check the spelling (compare to '" +
@@ -1019,7 +1019,8 @@ Result<Authenticator*> createCustomAuthenticator(
   LOG(INFO) << "Creating '" << authenticatorName << "' HTTP authenticator "
             << "for realm '" << realm << "'";
 
-  return modules::ModuleManager::create<Authenticator>(authenticatorName);
+  return modules::ModuleManager::create<
+      process::http::authentication::Authenticator>(authenticatorName);
 }
 
 } // namespace {
@@ -1035,10 +1036,12 @@ Try<Nothing> initializeHttpAuthenticators(
         "No HTTP authenticators specified for realm '" + realm + "'");
   }
 
-  Option<Authenticator*> authenticator;
+  Option<process::http::authentication::Authenticator*> authenticator;
 
   if (authenticatorNames.size() == 1) {
-    Result<Authenticator*> authenticator_ = None();
+    Result<process::http::authentication::Authenticator*> authenticator_ =
+      None();
+
     if (authenticatorNames[0] == internal::DEFAULT_BASIC_HTTP_AUTHENTICATOR) {
       authenticator_ =
         createBasicAuthenticator(realm, authenticatorNames[0], credentials);
@@ -1063,9 +1066,11 @@ Try<Nothing> initializeHttpAuthenticators(
   } else {
     // There are multiple authenticators loaded for this realm,
     // so construct a `CombinedAuthenticator` to handle them.
-    vector<Owned<Authenticator>> authenticators;
+    vector<Owned<process::http::authentication::Authenticator>> authenticators;
     foreach (const string& name, authenticatorNames) {
-      Result<Authenticator*> authenticator_ = None();
+      Result<process::http::authentication::Authenticator*> authenticator_ =
+        None();
+
       if (name == internal::DEFAULT_BASIC_HTTP_AUTHENTICATOR) {
         authenticator_ = createBasicAuthenticator(realm, name, credentials);
 #ifdef USE_SSL_SOCKET
@@ -1083,7 +1088,9 @@ Try<Nothing> initializeHttpAuthenticators(
       }
 
       CHECK_SOME(authenticator_);
-      authenticators.push_back(Owned<Authenticator>(authenticator_.get()));
+      authenticators.push_back(
+          Owned<process::http::authentication::Authenticator>(
+              authenticator_.get()));
     }
 
     authenticator = new CombinedAuthenticator(realm, 
std::move(authenticators));
@@ -1093,7 +1100,8 @@ Try<Nothing> initializeHttpAuthenticators(
 
   // Ownership of the authenticator is passed to libprocess.
   process::http::authentication::setAuthenticator(
-      realm, Owned<Authenticator>(authenticator.get()));
+      realm, Owned<process::http::authentication::Authenticator>(
+          authenticator.get()));
 
   return Nothing();
 }

Reply via email to