summaryrefslogtreecommitdiff
path: root/src/mongo/db/auth
diff options
context:
space:
mode:
authorSara Golemon <sara.golemon@mongodb.com>2018-06-13 17:31:38 -0400
committerSara Golemon <sara.golemon@mongodb.com>2018-06-14 13:12:23 -0400
commit940ed1e95db94d132f018a82343fe0109b157272 (patch)
treed5a699ffc17aea54caf8009026033dc2f304d441 /src/mongo/db/auth
parent2a66542157d5eac9ad43c749f3531bd57097cd26 (diff)
downloadmongo-940ed1e95db94d132f018a82343fe0109b157272.tar.gz
SERVER-35566 Proxy Cyrus/LDAP selection at runtime.
Diffstat (limited to 'src/mongo/db/auth')
-rw-r--r--src/mongo/db/auth/sasl_mechanism_registry.h5
-rw-r--r--src/mongo/db/auth/sasl_mechanism_registry_test.cpp10
-rw-r--r--src/mongo/db/auth/sasl_plain_server_conversation.h3
-rw-r--r--src/mongo/db/auth/sasl_scram_server_conversation.h2
4 files changed, 8 insertions, 12 deletions
diff --git a/src/mongo/db/auth/sasl_mechanism_registry.h b/src/mongo/db/auth/sasl_mechanism_registry.h
index ee10fd4cc4b..6d8fba8efd0 100644
--- a/src/mongo/db/auth/sasl_mechanism_registry.h
+++ b/src/mongo/db/auth/sasl_mechanism_registry.h
@@ -306,9 +306,8 @@ public:
return false;
}
- invariant(_getMapRef(T::mechanism_type::isInternal)
- .emplace(mechName.toString(), std::make_unique<T>())
- .second);
+ invariant(
+ _getMapRef(T::isInternal).emplace(mechName.toString(), std::make_unique<T>()).second);
return true;
}
diff --git a/src/mongo/db/auth/sasl_mechanism_registry_test.cpp b/src/mongo/db/auth/sasl_mechanism_registry_test.cpp
index bdce3b21199..6122498e20a 100644
--- a/src/mongo/db/auth/sasl_mechanism_registry_test.cpp
+++ b/src/mongo/db/auth/sasl_mechanism_registry_test.cpp
@@ -74,10 +74,8 @@ struct FooPolicy {
}
};
-template <bool argIsInternal>
class FooMechanism : public MakeServerMechanism<FooPolicy> {
public:
- static const bool isInternal = argIsInternal;
explicit FooMechanism(std::string authenticationDatabase)
: MakeServerMechanism<FooPolicy>(std::move(authenticationDatabase)) {}
@@ -89,8 +87,9 @@ protected:
};
template <bool argIsInternal>
-class FooMechanismFactory : public MakeServerFactory<FooMechanism<argIsInternal>> {
+class FooMechanismFactory : public MakeServerFactory<FooMechanism> {
public:
+ static constexpr bool isInternal = argIsInternal;
bool canMakeMechanismForUser(const User* user) const final {
return true;
}
@@ -107,10 +106,8 @@ struct BarPolicy {
}
};
-template <bool argIsInternal>
class BarMechanism : public MakeServerMechanism<BarPolicy> {
public:
- static const bool isInternal = argIsInternal;
explicit BarMechanism(std::string authenticationDatabase)
: MakeServerMechanism<BarPolicy>(std::move(authenticationDatabase)) {}
@@ -122,8 +119,9 @@ protected:
};
template <bool argIsInternal>
-class BarMechanismFactory : public MakeServerFactory<BarMechanism<argIsInternal>> {
+class BarMechanismFactory : public MakeServerFactory<BarMechanism> {
public:
+ static constexpr bool isInternal = argIsInternal;
bool canMakeMechanismForUser(const User* user) const final {
return true;
}
diff --git a/src/mongo/db/auth/sasl_plain_server_conversation.h b/src/mongo/db/auth/sasl_plain_server_conversation.h
index 13d7003c65c..3047664c2b3 100644
--- a/src/mongo/db/auth/sasl_plain_server_conversation.h
+++ b/src/mongo/db/auth/sasl_plain_server_conversation.h
@@ -35,8 +35,6 @@ namespace mongo {
class SASLPlainServerMechanism : public MakeServerMechanism<PLAINPolicy> {
public:
- static const bool isInternal = true;
-
explicit SASLPlainServerMechanism(std::string authenticationDatabase)
: MakeServerMechanism<PLAINPolicy>(std::move(authenticationDatabase)) {}
@@ -47,6 +45,7 @@ private:
class PLAINServerFactory : public MakeServerFactory<SASLPlainServerMechanism> {
public:
+ static constexpr bool isInternal = true;
bool canMakeMechanismForUser(const User* user) const final {
auto credentials = user->getCredentials();
return !credentials.isExternal && (credentials.scram<SHA1Block>().isValid() ||
diff --git a/src/mongo/db/auth/sasl_scram_server_conversation.h b/src/mongo/db/auth/sasl_scram_server_conversation.h
index 8338fc3e676..23e82a3f6df 100644
--- a/src/mongo/db/auth/sasl_scram_server_conversation.h
+++ b/src/mongo/db/auth/sasl_scram_server_conversation.h
@@ -42,7 +42,6 @@ template <typename Policy>
class SaslSCRAMServerMechanism : public MakeServerMechanism<Policy> {
public:
using HashBlock = typename Policy::HashBlock;
- static const bool isInternal = true;
explicit SaslSCRAMServerMechanism(std::string authenticationDatabase)
: MakeServerMechanism<Policy>(std::move(authenticationDatabase)) {}
@@ -94,6 +93,7 @@ extern template class SaslSCRAMServerMechanism<SCRAMSHA256Policy>;
template <typename ScramMechanism>
class SCRAMServerFactory : public MakeServerFactory<ScramMechanism> {
public:
+ static constexpr bool isInternal = true;
bool canMakeMechanismForUser(const User* user) const final {
auto credentials = user->getCredentials();
return credentials.scram<typename ScramMechanism::HashBlock>().isValid();