openDAQ
Open data acquisition platform
IAuthenticationProvider Struct Referenceabstract

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

+ Inheritance diagram for IAuthenticationProvider:
+ Collaboration diagram for 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

virtual ErrCode INTERFACE_FUNC authenticate (IString *username, IString *password, IUser **userOut)=0
 Authenticate user using username and password. If authentication is successful, a User instance is returned. Otherwise an exception is thrown. More...
 
virtual ErrCode INTERFACE_FUNC isAnonymousAllowed (Bool *allowedOut)=0
 Returns true if anonymous authentication is allowed. When anonymous authentication is enabled, user can connect to the server without providing username or password. More...
 
virtual ErrCode INTERFACE_FUNC authenticateAnonymous (IUser **userOut)=0
 Authenticate as anonymous user. If anonymous authentication is not allowed, an exception is thrown. More...
 
virtual ErrCode INTERFACE_FUNC findUser (IString *username, IUser **userOut)=0
 Find a user instance by its username. If no user with maching username is not found, null is returned. More...
 
- Public Member Functions inherited from IBaseObject
virtual ErrCode INTERFACE_FUNC borrowInterface (const IntfID &intfID, void **obj) const =0
 Returns another interface which is supported by the object without incrementing the reference count. More...
 
virtual ErrCode INTERFACE_FUNC dispose ()=0
 Disposes all references held by the object. More...
 
virtual ErrCode INTERFACE_FUNC getHashCode (SizeT *hashCode)=0
 Returns hash code of the object. More...
 
virtual ErrCode INTERFACE_FUNC equals (IBaseObject *other, Bool *equal) const =0
 Compares object to another object for equality. More...
 
virtual ErrCode INTERFACE_FUNC toString (CharPtr *str)=0
 Returns a string representation of the object. More...
 
- Public Member Functions inherited from IUnknown
virtual ErrCode INTERFACE_FUNC queryInterface (const IntfID &intfID, void **obj)=0
 Returns another interface which is supported by the object and increments the reference count. More...
 
virtual int INTERFACE_FUNC addRef ()=0
 Increments the reference count for an interface on an object. More...
 
virtual int INTERFACE_FUNC releaseRef ()=0
 Decrements the reference count for an interface on an object. More...
 

Member Function Documentation

◆ authenticate()

virtual ErrCode INTERFACE_FUNC authenticate ( IString username,
IString password,
IUser **  userOut 
)
pure virtual

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()

virtual ErrCode INTERFACE_FUNC authenticateAnonymous ( IUser **  userOut)
pure virtual

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()

virtual ErrCode INTERFACE_FUNC findUser ( IString username,
IUser **  userOut 
)
pure virtual

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()

virtual ErrCode INTERFACE_FUNC isAnonymousAllowed ( Bool *  allowedOut)
pure virtual

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.