![]() |
cutelyst 5.1.0
A C++ Web Framework built on top of Qt, using the simple approach of Catalyst (Perl) framework.
|
Authentication store backed by an LDAP directory. More...
#include <Cutelyst/Plugins/Authentication/storeldap.h>
Public Types | |
| enum class | SearchScope { Base , OneLevel , SubTree } |
This store is based on Catalyst::Authentication::Store::LDAP semantics: user data is searched in LDAP using the configured base DN and filter, then mapped to AuthenticationUser values.
Build with OpenLDAP development files available to enable LDAP support. If LDAP support is not available at build time, findUser() will always return a null AuthenticationUser and log a warning.
Definition at line 26 of file storeldap.h.
|
strong |
LDAP search scope values.
Definition at line 32 of file storeldap.h.
| StoreLDAP::StoreLDAP | ( | ) |
Constructs a new StoreLDAP object.
Definition at line 21 of file storeldap.cpp.
|
override |
Destroys the StoreLDAP object.
Definition at line 30 of file storeldap.cpp.
| QStringList StoreLDAP::attributes | ( | ) | const |
Returns list of LDAP attributes requested during search.
Definition at line 210 of file storeldap.cpp.
Referenced by setAttributes().
| QString StoreLDAP::bindDn | ( | ) | const |
Returns bind DN used for LDAP searches.
Definition at line 145 of file storeldap.cpp.
Referenced by setBindDn().
|
finaloverridevirtual |
Reimplemented from AuthenticationStore::findUser().
Implements Cutelyst::AuthenticationStore.
Definition at line 34 of file storeldap.cpp.
References QString::isEmpty(), and QMultiMap::value().
|
finaloverridevirtual |
Reimplemented from AuthenticationStore::forSession().
Reimplemented from Cutelyst::AuthenticationStore.
Definition at line 45 of file storeldap.cpp.
References Cutelyst::AuthenticationUser::data().
|
finaloverridevirtual |
Reimplemented from AuthenticationStore::fromSession().
Reimplemented from Cutelyst::AuthenticationStore.
Definition at line 52 of file storeldap.cpp.
References QVariant::canConvert(), Cutelyst::AuthenticationUser::setData(), QVariant::toMap(), and QVariant::toString().
| QString StoreLDAP::idAttribute | ( | ) | const |
Returns the LDAP attribute used as AuthenticationUser::id().
Definition at line 180 of file storeldap.cpp.
Referenced by setIdAttribute().
| QStringList StoreLDAP::serverUris | ( | ) | const |
Returns LDAP server URI list.
Definition at line 135 of file storeldap.cpp.
Referenced by setServerUris().
| void StoreLDAP::setAttributes | ( | const QStringList & | attributes | ) |
Sets list of LDAP attributes to request. Empty list means all attributes.
Definition at line 205 of file storeldap.cpp.
References attributes().
| void StoreLDAP::setBindDn | ( | const QString & | bindDn | ) |
Sets bind DN used to perform LDAP searches.
Definition at line 140 of file storeldap.cpp.
References bindDn().
| void StoreLDAP::setBindPassword | ( | const QString & | bindPassword | ) |
Sets bind password used to perform LDAP searches.
Definition at line 150 of file storeldap.cpp.
| void StoreLDAP::setIdAttribute | ( | const QString & | idAttribute | ) |
Sets the LDAP attribute used as AuthenticationUser::id().
Definition at line 175 of file storeldap.cpp.
References idAttribute().
| void StoreLDAP::setServerUris | ( | const QStringList & | serverUris | ) |
Sets LDAP server URI list (for example ldap://127.0.0.1:389).
Definition at line 130 of file storeldap.cpp.
References serverUris().
| void StoreLDAP::setStartTls | ( | bool | startTls | ) |
Enables or disables STARTTLS before bind/search.
Definition at line 215 of file storeldap.cpp.
References startTls().
| void StoreLDAP::setUserBaseDn | ( | const QString & | baseDn | ) |
Sets the LDAP base DN where users are searched.
Definition at line 155 of file storeldap.cpp.
| void StoreLDAP::setUserField | ( | const QString & | userField | ) |
Sets the field used to get user name from auth/user info.
Definition at line 165 of file storeldap.cpp.
References userField().
| void StoreLDAP::setUserFilter | ( | const QString & | userFilter | ) |
Sets the LDAP filter template used to find a user.
The template may contain %1 placeholder for an escaped user value.
Definition at line 185 of file storeldap.cpp.
References userFilter().
| void StoreLDAP::setUserScope | ( | StoreLDAP::SearchScope | scope | ) |
Sets LDAP search scope used to find users.
Definition at line 195 of file storeldap.cpp.
| bool StoreLDAP::startTls | ( | ) | const |
Returns true when STARTTLS is enabled.
Definition at line 220 of file storeldap.cpp.
Referenced by setStartTls().
| QString StoreLDAP::userBaseDn | ( | ) | const |
Returns the LDAP base DN where users are searched.
Definition at line 160 of file storeldap.cpp.
| QString StoreLDAP::userField | ( | ) | const |
Returns the field used to get user name from auth/user info.
Definition at line 170 of file storeldap.cpp.
Referenced by setUserField().
| QString StoreLDAP::userFilter | ( | ) | const |
Returns the LDAP filter template used to find a user.
Definition at line 190 of file storeldap.cpp.
Referenced by setUserFilter().
| StoreLDAP::SearchScope StoreLDAP::userScope | ( | ) | const |
Returns LDAP search scope used to find users.
Definition at line 200 of file storeldap.cpp.
|
virtual |
Validates clear text password by binding to LDAP with the user DN.
Reimplemented from Cutelyst::AuthenticationStore.
Definition at line 64 of file storeldap.cpp.
References QByteArray::constData(), QList::isEmpty(), QString::isEmpty(), QStringList::join(), QByteArray::size(), QVariant::toString(), QString::toUtf8(), and Cutelyst::AuthenticationUser::value().