openDAQ
Open data acquisition platform
AuthenticationProviderPtr Class Reference

A class which is responsible for authenticating a user. The authentication is usually done by verifying the username and password. An authenticator implementation might use external services for achieving that. It might make a call to an external databse, do a lookup to a json file with defined users or it might simply check the password against a hardcoded one. More...

Inherits ObjectPtr< IAuthenticationProvider >.

Detailed Description

A class which is responsible for authenticating a user. The authentication is usually done by verifying the username and password. An authenticator implementation might use external services for achieving that. It might make a call to an external databse, do a lookup to a json file with defined users or it might simply check the password against a hardcoded one.

Public Member Functions

daq::UserPtr authenticate (const daq::StringPtr &username, const daq::StringPtr &password) const
 Authenticate user using username and password. If authentication is successful, a User instance is returned. Otherwise an exception is thrown. More...
 
daq::Bool isAnonymousAllowed () const
 Returns true if anonymous authentication is allowed. When anonymous authentication is enabled, user can connect to the server without providing username or password. More...
 
daq::UserPtr authenticateAnonymous () const
 Authenticate as anonymous user. If anonymous authentication is not allowed, an exception is thrown. More...
 
daq::UserPtr findUser (const daq::StringPtr &username) const
 Find a user instance by its username. If no user with maching username is not found, null is returned. More...
 

Member Function Documentation

◆ authenticate()

daq::UserPtr authenticate ( const daq::StringPtr &  username,
const daq::StringPtr &  password 
) const
inline

Authenticate user using username and password. If authentication is successful, a User instance is returned. Otherwise an exception is thrown.

Parameters
usernameThe username.
passwordThe password in plain text.
user[out]And instance of successfully authenticated user. If authentication is not successful, an exception is thrown.

◆ authenticateAnonymous()

daq::UserPtr authenticateAnonymous ( ) const
inline

Authenticate as anonymous user. If anonymous authentication is not allowed, an exception is thrown.

Parameters
user[out]Pointer to anonymous user instance. If authentication is not successful, an exception is thrown.

◆ findUser()

daq::UserPtr findUser ( const daq::StringPtr &  username) const
inline

Find a user instance by its username. If no user with maching username is not found, null is returned.

Parameters
usernameThe username.
userOut[out]Found user instance. If no user with maching username is not found, null is returned.

◆ isAnonymousAllowed()

daq::Bool isAnonymousAllowed ( ) const
inline

Returns true if anonymous authentication is allowed. When anonymous authentication is enabled, user can connect to the server without providing username or password.

Parameters
allowedOut[out]True if anonymous authentication is allowed.