Kea
1.9.9-git
|
Basic HTTP authentication configuration. More...
#include <basic_auth_config.h>
Public Member Functions | |
virtual | ~BasicHttpAuthConfig () |
Destructor. More... | |
void | add (const std::string &user, const std::string &password, const isc::data::ConstElementPtr &user_context=isc::data::ConstElementPtr()) |
Add a client configuration. More... | |
virtual isc::http::HttpResponseJsonPtr | checkAuth (const isc::http::HttpResponseCreator &creator, const isc::http::HttpRequestPtr &request) const |
Validate HTTP request. More... | |
virtual void | clear () |
Clear configuration. More... | |
virtual bool | empty () const |
Empty predicate. More... | |
const BasicHttpAuthClientList & | getClientList () const |
Returns the list of client configuration. More... | |
const BasicHttpAuthMap & | getCredentialMap () const |
Returns the credential and user id map. More... | |
void | parse (const isc::data::ConstElementPtr &config) |
Parses basic HTTP authentication configuration. More... | |
virtual isc::data::ElementPtr | toElement () const |
Unparses basic HTTP authentication configuration. More... | |
Public Member Functions inherited from isc::http::HttpAuthConfig | |
virtual | ~HttpAuthConfig () |
Destructor. More... | |
const std::string & | getRealm () const |
Returns the realm. More... | |
void | setRealm (const std::string &realm) |
Set the realm. More... | |
Public Member Functions inherited from isc::data::UserContext | |
void | contextToElement (data::ElementPtr map) const |
Merge unparse a user_context object. More... | |
data::ConstElementPtr | getContext () const |
Returns const pointer to the user context. More... | |
void | setContext (const data::ConstElementPtr &ctx) |
Sets user context. More... | |
Public Member Functions inherited from isc::data::CfgToElement | |
virtual | ~CfgToElement () |
Destructor. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from isc::data::UserContext | |
static data::ElementPtr | toElement (data::ConstElementPtr map) |
Copy an Element map. More... | |
Protected Attributes inherited from isc::data::UserContext | |
data::ConstElementPtr | user_context_ |
Pointer to the user context (may be NULL) More... | |
Basic HTTP authentication configuration.
Definition at line 67 of file basic_auth_config.h.
|
inlinevirtual |
Destructor.
Definition at line 71 of file basic_auth_config.h.
void isc::http::BasicHttpAuthConfig::add | ( | const std::string & | user, |
const std::string & | password, | ||
const isc::data::ConstElementPtr & | user_context = isc::data::ConstElementPtr() |
||
) |
Add a client configuration.
user | User id |
password | Password |
user_context | Optional user context |
BadValue | if the user id contains the ':' character. |
Definition at line 48 of file basic_auth_config.cc.
References isc::http::BasicHttpAuth::getCredential().
Referenced by parse().
|
virtual |
Validate HTTP request.
creator | The HTTP response creator. |
request | The HTTP request to validate. |
Implements isc::http::HttpAuthConfig.
Definition at line 204 of file basic_auth_config.cc.
References isc::http::auth_logger, isc::http::HttpResponseCreator::createStockHttpResponse(), getCredentialMap(), isc::http::HttpAuthConfig::getRealm(), isc::http::HTTP_CLIENT_REQUEST_AUTHORIZED, isc::http::HTTP_CLIENT_REQUEST_BAD_AUTH_HEADER, isc::http::HTTP_CLIENT_REQUEST_NO_AUTH_HEADER, isc::http::HTTP_CLIENT_REQUEST_NOT_AUTHORIZED, isc_throw, LOG_INFO, isc::util::str::lowercase(), isc::util::str::trim(), isc::http::UNAUTHORIZED, and isc::Exception::what().
|
virtual |
Clear configuration.
Implements isc::http::HttpAuthConfig.
Definition at line 57 of file basic_auth_config.cc.
|
virtual |
Empty predicate.
Implements isc::http::HttpAuthConfig.
Definition at line 63 of file basic_auth_config.cc.
|
inline |
Returns the list of client configuration.
Definition at line 94 of file basic_auth_config.h.
|
inline |
Returns the credential and user id map.
Definition at line 101 of file basic_auth_config.h.
Referenced by checkAuth().
|
virtual |
Parses basic HTTP authentication configuration.
config | Element holding the basic HTTP authentication configuration to be parsed. |
DhcpConfigError | when the configuration is invalid. |
Implements isc::http::HttpAuthConfig.
Definition at line 91 of file basic_auth_config.cc.
References add(), isc_throw, isc::data::UserContext::setContext(), isc::http::HttpAuthConfig::setRealm(), and isc::Exception::what().
|
virtual |
Unparses basic HTTP authentication configuration.
Implements isc::http::HttpAuthConfig.
Definition at line 68 of file basic_auth_config.cc.
References isc::data::UserContext::contextToElement(), and isc::http::HttpAuthConfig::getRealm().