cutelyst 4.9.0
A C++ Web Framework built on top of Qt, using the simple approach of Catalyst (Perl) framework.
Cutelyst::AuthenticationCredential Class Referenceabstract

Abstract class to validate authentication credentials like user name and password. More...

#include <Cutelyst/Plugins/Authentication/authentication.h>

Inheritance diagram for Cutelyst::AuthenticationCredential:

Public Member Functions

 AuthenticationCredential (QObject *parent=nullptr)
virtual ~AuthenticationCredential ()
virtual AuthenticationUser authenticate (Context *c, AuthenticationRealm *realm, const ParamsMultiMap &authinfo)=0

Detailed Description

Use this class to create your own credential validator. Reimplement the pure virtual function authenticate() in your derived class and set the object as credential to your AuthenticationRealm. See CredentialPassword for an example implementation.

Cutelyst already ships some implementations to verify optionally PBKDF2 derived passwords from user input and HTTP headers.

For an example implementation see Authentication overview.

Definition at line 33 of file authentication.h.

Constructor & Destructor Documentation

◆ AuthenticationCredential()

Cutelyst::AuthenticationCredential::AuthenticationCredential ( QObject * parent = nullptr)
explicit

Constructs a new AuthenticationCredential object with the given parent.

Definition at line 272 of file authentication.cpp.

Referenced by Cutelyst::CredentialHttp::CredentialHttp(), and Cutelyst::CredentialPassword::CredentialPassword().

◆ ~AuthenticationCredential()

Cutelyst::AuthenticationCredential::~AuthenticationCredential ( )
virtual

Destroys the AuthenticationCredential object.

Definition at line 277 of file authentication.cpp.

Member Function Documentation

◆ authenticate()

virtual AuthenticationUser Cutelyst::AuthenticationCredential::authenticate ( Context * c,
AuthenticationRealm * realm,
const ParamsMultiMap & authinfo )
pure virtual

Tries to authenticate the authinfo using the given realm. When reimplementing, get the credentials like user name and password provided by the user from the authinfo and find the user data in the authentication realm with AuthenticationRealm::findUser(). Than validate the user data and return a not null AuthenticationUser in case off success.

Implemented in Cutelyst::CredentialHttp, and Cutelyst::CredentialPassword.