cutelyst
4.5.1
A C++ Web Framework built on top of Qt, using the simple approach of Catalyst (Perl) framework.
|
Authentication data store using a flat file. More...
#include <Cutelyst/Plugins/Authentication/htpasswd.h>
Public Member Functions | |
StoreHtpasswd (const QString &name) | |
virtual | ~StoreHtpasswd () override |
void | addUser (const ParamsMultiMap &user) |
AuthenticationUser | findUser (Context *c, const ParamsMultiMap &userInfo) override final |
QVariant | forSession (Context *c, const AuthenticationUser &user) override final |
AuthenticationUser | fromSession (Context *c, const QVariant &frozenUser) override final |
Public Member Functions inherited from Cutelyst::AuthenticationStore | |
AuthenticationStore () | |
virtual | ~AuthenticationStore () |
virtual AuthenticationUser | autoCreateUser (Context *c, const ParamsMultiMap &userinfo) const |
virtual AuthenticationUser | autoUpdateUser (Context *c, const ParamsMultiMap &userinfo) const |
virtual bool | canAutoCreateUser () const |
virtual bool | canAutoUpdateUser () const |
This authentication data store stores user data as a combination of username:password
in a flat file where each row contains one user. This is like the file created by Apache’s htpasswd command.
Definition at line 20 of file htpasswd.h.
StoreHtpasswd::StoreHtpasswd | ( | const QString & | name | ) |
Constructs a new StoreHtpasswd object with the given file name.
Definition at line 17 of file htpasswd.cpp.
|
overridevirtual |
Destroys the StoreHtpasswd object.
Definition at line 22 of file htpasswd.cpp.
void StoreHtpasswd::addUser | ( | const ParamsMultiMap & | user | ) |
Appends the user to htpasswd storage
Definition at line 26 of file htpasswd.cpp.
References QFileDevice::atEnd(), QFileDevice::close(), QFile::exists(), QList::first(), QTemporaryFile::open(), QFile::open(), QIODevice::readLine(), QIODeviceBase::ReadWrite, QFile::remove(), QTemporaryFile::rename(), QTemporaryFile::setAutoRemove(), QList::size(), QByteArray::split(), QIODeviceBase::Text, QString::toLatin1(), QMultiMap::value(), and QIODevice::write().
|
finaloverridevirtual |
Reimplemented from AuthenticationStore::findUser().
Implements Cutelyst::AuthenticationStore.
Definition at line 70 of file htpasswd.cpp.
References QList::at(), QFileDevice::atEnd(), QList::first(), QString::fromLatin1(), Cutelyst::AuthenticationUser::insert(), QFile::open(), QIODevice::readLine(), QIODeviceBase::ReadOnly, QByteArray::replace(), Cutelyst::AuthenticationUser::setId(), QList::size(), QByteArray::split(), QIODeviceBase::Text, QString::toLatin1(), QByteArray::trimmed(), and QMultiMap::value().
Referenced by fromSession().
|
finaloverridevirtual |
Reimplemented from AuthenticationStore::forSession().
Reimplemented from Cutelyst::AuthenticationStore.
Definition at line 95 of file htpasswd.cpp.
References Cutelyst::AuthenticationUser::id().
|
finaloverridevirtual |
Reimplemented from AuthenticationStore::fromSession().
Reimplemented from Cutelyst::AuthenticationStore.
Definition at line 101 of file htpasswd.cpp.
References findUser(), and QVariant::toString().