mirror of https://gitee.com/bigwinds/arangodb
authentication realm
This commit is contained in:
parent
a0299f903b
commit
3ffdfe0756
|
@ -96,12 +96,24 @@ bool VocbaseContext::useClusterAuthentication () const {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief return authentication realm
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
char const* VocbaseContext::getRealm () const {
|
||||||
|
if (_vocbase == nullptr) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
return _vocbase->_name;
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief checks the authentication
|
/// @brief checks the authentication
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
HttpResponse::HttpResponseCode VocbaseContext::authenticate () {
|
HttpResponse::HttpResponseCode VocbaseContext::authenticate () {
|
||||||
TRI_ASSERT(_vocbase != 0);
|
TRI_ASSERT(_vocbase != nullptr);
|
||||||
|
|
||||||
if (! _vocbase->_settings.requireAuthentication) {
|
if (! _vocbase->_settings.requireAuthentication) {
|
||||||
// no authentication required at all
|
// no authentication required at all
|
||||||
|
|
|
@ -96,6 +96,12 @@ namespace triagens {
|
||||||
|
|
||||||
bool useClusterAuthentication () const;
|
bool useClusterAuthentication () const;
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief return authentication realm
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
char const* getRealm () const;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief checks the authentication
|
/// @brief checks the authentication
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -206,7 +206,15 @@ bool HttpHandlerFactory::setRequestContext (HttpRequest* request) {
|
||||||
/// @brief returns the authentication realm
|
/// @brief returns the authentication realm
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
string const& HttpHandlerFactory::authenticationRealm (HttpRequest*) const {
|
string HttpHandlerFactory::authenticationRealm (HttpRequest* request) const {
|
||||||
|
auto context = request->getRequestContext();
|
||||||
|
if (context != nullptr) {
|
||||||
|
auto realm = context->getRealm();
|
||||||
|
|
||||||
|
if (realm != nullptr) {
|
||||||
|
return _authenticationRealm + "/" + std::string(realm);
|
||||||
|
}
|
||||||
|
}
|
||||||
return _authenticationRealm;
|
return _authenticationRealm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -177,7 +177,7 @@ namespace triagens {
|
||||||
/// @brief returns the authentication realm
|
/// @brief returns the authentication realm
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
virtual std::string const& authenticationRealm (HttpRequest*) const;
|
virtual std::string authenticationRealm (HttpRequest*) const;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief creates a new request
|
/// @brief creates a new request
|
||||||
|
|
|
@ -80,9 +80,15 @@ namespace triagens {
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
virtual RequestUser* getRequestUser () {
|
virtual RequestUser* getRequestUser () {
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief return authentication realm
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
virtual char const* getRealm () const = 0;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief authenticate user
|
/// @brief authenticate user
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
Loading…
Reference in New Issue