Robot Raconteur Core C++ Library
Loading...
Searching...
No Matches
RobotRaconteur::PasswordFileUserAuthenticator Class Reference

Simple authenticator using a list of username, password hash, and privileges stored in a file or string. More...

#include <Security.h>

Inheritance diagram for RobotRaconteur::PasswordFileUserAuthenticator:
RobotRaconteur::UserAuthenticator

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< AuthenticatedUserAuthenticateUser (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.

Detailed Description

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:

user1 79e262a81dd19d40ae008f74eb59edce objectlock
user2 309825a0951b3cf1f25e27b61cee8243 objectlock
superuser1 11e5dfc68422e697563a4253ba360615 objectlock,objectlockoverride

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

Constructor & Destructor Documentation

◆ PasswordFileUserAuthenticator() [1/2]

RobotRaconteur::PasswordFileUserAuthenticator::PasswordFileUserAuthenticator ( std::istream & file,
bool require_verified_client = false )

Construct a new PasswordFileUserAuthenticator using text supplied as a stream.

Parameters
fileThe file text as a stream

◆ PasswordFileUserAuthenticator() [2/2]

RobotRaconteur::PasswordFileUserAuthenticator::PasswordFileUserAuthenticator ( boost::string_ref data,
bool require_verified_client = false )

Construct a new PasswordFileUserAuthenticator using text supplied as a string.

Parameters
dataThe file text

Member Function Documentation

◆ AuthenticateUser()

RR_OVIRTUAL boost::shared_ptr< AuthenticatedUser > RobotRaconteur::PasswordFileUserAuthenticator::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 )
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.

Parameters
usernameThe username provided by the client
credentialsThe credentials provided by the client
contextThe context of the service requesting authentication
Returns
RR_SHARED_PTR<AuthenticatedUser> An authenticated user object

Implements RobotRaconteur::UserAuthenticator.


The documentation for this class was generated from the following file: