|
QHttpEngine
1.0.0
Simple and secure HTTP server for Qt applications
|
Middleware for HTTP basic authentication More...
#include <qhttpengine/basicauthmiddleware.h>
Public Member Functions | |
| BasicAuthMiddleware (const QString &realm, QObject *parent=Q_NULLPTR) | |
| Base constructor for the middleware. More... | |
| void | add (const QString &username, const QString &password) |
| Add credentials to the list. More... | |
| virtual bool | process (Socket *socket) |
| Process the request. More... | |
Public Member Functions inherited from QHttpEngine::Middleware | |
| Middleware (QObject *parent=Q_NULLPTR) | |
| Base constructor for middleware. | |
Protected Member Functions | |
| virtual bool | verify (const QString &username, const QString &password) |
| Determine if the client is authorized. | |
HTTP Basic authentication allows access to specific resources to be restricted. This class uses a map to store accepted username/password combinations, which are then used for authenticating requests. To use a different method of authentication, override the verify() method in a derived class.
| QHttpEngine::BasicAuthMiddleware::BasicAuthMiddleware | ( | const QString & | realm, |
| QObject * | parent = Q_NULLPTR |
||
| ) |
The realm string is shown to a client when credentials are requested.
| void QHttpEngine::BasicAuthMiddleware::add | ( | const QString & | username, |
| const QString & | password | ||
| ) |
If the username has already been added, its password will be replaced with the new one provided.
|
virtual |
If the verify() method returns true, the client will be granted access to the resources. Otherwise, 401 Unauthorized will be returned.
Implements QHttpEngine::Middleware.
1.8.13