mirror of https://gitee.com/bigwinds/arangodb
added --server.local-authentication
This commit is contained in:
parent
802177995f
commit
1ac0cb9bb3
|
@ -1,6 +1,8 @@
|
||||||
v3.3.milestone1 (2017-10-06)
|
v3.3.milestone1 (2017-10-06)
|
||||||
----------------------------
|
----------------------------
|
||||||
|
|
||||||
|
* added option `--server.local-authentication`
|
||||||
|
|
||||||
* UI: added user roles
|
* UI: added user roles
|
||||||
|
|
||||||
* added config option `--log.color` to toggle colorful logging to terminal
|
* added config option `--log.color` to toggle colorful logging to terminal
|
||||||
|
|
|
@ -233,6 +233,15 @@ domain sockets.
|
||||||
Sets the cache timeout to *value* (in seconds). This is only necessary
|
Sets the cache timeout to *value* (in seconds). This is only necessary
|
||||||
if you use an external authentication system like LDAP.
|
if you use an external authentication system like LDAP.
|
||||||
|
|
||||||
|
### Enable local authentication
|
||||||
|
|
||||||
|
`--server.local-authentication value`
|
||||||
|
|
||||||
|
If set to *false* only use the external authentication system. If
|
||||||
|
*true* also use the local *_users* collections.
|
||||||
|
|
||||||
|
The default value is *true*.
|
||||||
|
|
||||||
### Enable/disable replication applier
|
### Enable/disable replication applier
|
||||||
|
|
||||||
`--database.replication-applier flag`
|
`--database.replication-applier flag`
|
||||||
|
|
|
@ -46,6 +46,7 @@ AuthenticationFeature::AuthenticationFeature(
|
||||||
_authenticationUnixSockets(true),
|
_authenticationUnixSockets(true),
|
||||||
_authenticationSystemOnly(true),
|
_authenticationSystemOnly(true),
|
||||||
_authenticationTimeout(0.0),
|
_authenticationTimeout(0.0),
|
||||||
|
_localAuthentication(true),
|
||||||
_jwtSecretProgramOption(""),
|
_jwtSecretProgramOption(""),
|
||||||
_active(true) {
|
_active(true) {
|
||||||
setOptional(true);
|
setOptional(true);
|
||||||
|
@ -84,6 +85,10 @@ void AuthenticationFeature::collectOptions(
|
||||||
"timeout for the authentication cache (0 = indefinitely)",
|
"timeout for the authentication cache (0 = indefinitely)",
|
||||||
new DoubleParameter(&_authenticationTimeout));
|
new DoubleParameter(&_authenticationTimeout));
|
||||||
|
|
||||||
|
options->addOption("--server.local-authentication",
|
||||||
|
"enable or disable authentication using the local user database",
|
||||||
|
new BooleanParameter(&_localAuthentication));
|
||||||
|
|
||||||
options->addOption(
|
options->addOption(
|
||||||
"--server.authentication-system-only",
|
"--server.authentication-system-only",
|
||||||
"use HTTP authentication only for requests to /_api and /_admin",
|
"use HTTP authentication only for requests to /_api and /_admin",
|
||||||
|
|
|
@ -51,6 +51,7 @@ class AuthenticationFeature final
|
||||||
bool _authenticationUnixSockets;
|
bool _authenticationUnixSockets;
|
||||||
bool _authenticationSystemOnly;
|
bool _authenticationSystemOnly;
|
||||||
double _authenticationTimeout;
|
double _authenticationTimeout;
|
||||||
|
bool _localAuthentication;
|
||||||
|
|
||||||
std::string _jwtSecretProgramOption;
|
std::string _jwtSecretProgramOption;
|
||||||
bool _active;
|
bool _active;
|
||||||
|
@ -65,6 +66,7 @@ class AuthenticationFeature final
|
||||||
authInfo()->setJwtSecret(jwtSecret);
|
authInfo()->setJwtSecret(jwtSecret);
|
||||||
}
|
}
|
||||||
double authenticationTimeout() const { return _authenticationTimeout; }
|
double authenticationTimeout() const { return _authenticationTimeout; }
|
||||||
|
bool localAuthentication() const { return _localAuthentication; }
|
||||||
|
|
||||||
AuthInfo* authInfo();
|
AuthInfo* authInfo();
|
||||||
AuthLevel canUseDatabase(std::string const& username,
|
AuthLevel canUseDatabase(std::string const& username,
|
||||||
|
|
|
@ -793,6 +793,12 @@ AuthResult AuthInfo::checkPassword(std::string const& username,
|
||||||
READ_LOCKER(readLocker, _authInfoLock);
|
READ_LOCKER(readLocker, _authInfoLock);
|
||||||
|
|
||||||
auto it = _authInfo.find(username);
|
auto it = _authInfo.find(username);
|
||||||
|
auto feature = AuthenticationFeature::INSTANCE;
|
||||||
|
|
||||||
|
if (it != _authInfo.end() && (it->second.source() == AuthSource::COLLECTION)
|
||||||
|
&& feature != nullptr && ! feature->localAuthentication()) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
if (it == _authInfo.end() || (it->second.source() == AuthSource::LDAP)) {
|
if (it == _authInfo.end() || (it->second.source() == AuthSource::LDAP)) {
|
||||||
TRI_ASSERT(_authenticationHandler);
|
TRI_ASSERT(_authenticationHandler);
|
||||||
|
@ -843,10 +849,12 @@ AuthResult AuthInfo::checkPassword(std::string const& username,
|
||||||
|
|
||||||
if (it != _authInfo.end()) {
|
if (it != _authInfo.end()) {
|
||||||
AuthUserEntry const& auth = it->second;
|
AuthUserEntry const& auth = it->second;
|
||||||
|
|
||||||
if (auth.isActive()) {
|
if (auth.isActive()) {
|
||||||
result._authorized = auth.checkPassword(password);
|
result._authorized = auth.checkPassword(password);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -958,7 +966,6 @@ AuthResult AuthInfo::checkAuthenticationBasic(std::string const& secret) {
|
||||||
std::string password = up.substr(n + 1);
|
std::string password = up.substr(n + 1);
|
||||||
|
|
||||||
AuthResult result = checkPassword(username, password);
|
AuthResult result = checkPassword(username, password);
|
||||||
|
|
||||||
double timeout = AuthenticationFeature::INSTANCE->authenticationTimeout();
|
double timeout = AuthenticationFeature::INSTANCE->authenticationTimeout();
|
||||||
|
|
||||||
if (0 < timeout) {
|
if (0 < timeout) {
|
||||||
|
|
Loading…
Reference in New Issue