|
Robot Raconteur Core C++ Library
|
Simple authenticator using a list of username, password hash, and privileges stored in a file or string. More...
#include <Security.h>
Public Member Functions | |
| PasswordFileUserAuthenticator (std::istream &file, bool require_verified_client=false) | |
| Construct a new PasswordFileUserAuthenticator using text supplied as a stream. | |
| PasswordFileUserAuthenticator (boost::string_ref data, bool require_verified_client=false) | |
| Construct a new PasswordFileUserAuthenticator using text supplied as a string. | |
| RR_OVIRTUAL boost::shared_ptr< AuthenticatedUser > | AuthenticateUser (boost::string_ref username, const std::map< std::string, boost::intrusive_ptr< RRValue > > &credentials, const boost::shared_ptr< ServerContext > &context, const boost::shared_ptr< ITransportConnection > &transport) RR_OVERRIDE |
| Authenticate a user using username and credentials. | |
Simple authenticator using a list of username, password hash, and privileges stored in a file or string.
The password user authenticator expects a string or istream containing a list of users, one per line. Each line contains the username, password as md5 hash, and privileges, separated by white spaces. An example of authentication file contents:
The password is md5 hashed. This hash can be generated using the --md5passwordhash command in `RobotRaconteurGen` Utility. The privileges are comma separated. Valid privileges are as follows:
| Privilege Name | Description |
|---|---|
| objectlock | Allow user to lock objects |
| objectlockoverride | Allow user to unlock object locks made by other users |
| RobotRaconteur::PasswordFileUserAuthenticator::PasswordFileUserAuthenticator | ( | std::istream & | file, |
| bool | require_verified_client = false ) |
Construct a new PasswordFileUserAuthenticator using text supplied as a stream.
| file | The file text as a stream |
| RobotRaconteur::PasswordFileUserAuthenticator::PasswordFileUserAuthenticator | ( | boost::string_ref | data, |
| bool | require_verified_client = false ) |
Construct a new PasswordFileUserAuthenticator using text supplied as a string.
| data | The file text |
|
virtual |
Authenticate a user using username and credentials.
The service will call AuthenticateUser when clients attempt to authenticate. The username and credentials are passed to RobotRaconteurNode::ConnectService() or RobotRaconteurNode::AsyncConnectService(). The authenticator must analyze these values to decide how to authenticate the user.
On successful authentication, return a populated AuthenticatedUser object. On failure, throw an exception.
See Security for more information.
| username | The username provided by the client |
| credentials | The credentials provided by the client |
| context | The context of the service requesting authentication |
Implements RobotRaconteur::UserAuthenticator.