cutelyst 3.9.1
A C++ Web Framework built on top of Qt, using the simple approach of Catalyst (Perl) framework.
credentialhttp.h
1/*
2 * SPDX-FileCopyrightText: (C) 2013-2022 Daniel Nicoletti <dantti12@gmail.com>
3 * SPDX-License-Identifier: BSD-3-Clause
4 */
5#ifndef CREDENTIALHTTP_H
6#define CREDENTIALHTTP_H
7
8#include <Cutelyst/Plugins/Authentication/authentication.h>
9#include <Cutelyst/cutelyst_global.h>
10
11#include <QtCore/QCryptographicHash>
12
13namespace Cutelyst {
14
15class CredentialHttpPrivate;
16class CUTELYST_PLUGIN_AUTHENTICATION_EXPORT CredentialHttp : public AuthenticationCredential
17{
19 Q_DECLARE_PRIVATE(CredentialHttp)
20public:
21 enum PasswordType {
22 None,
23 Clear,
24 Hashed,
25 };
26 Q_ENUM(PasswordType)
27
28 enum AuthType {
29 Any,
30 Basic,
31 };
32 Q_ENUM(AuthType)
33
34
37 explicit CredentialHttp(QObject *parent = nullptr);
38 virtual ~CredentialHttp();
39
46 void setType(CredentialHttp::AuthType type);
47
53 void setAuthorizationRequiredMessage(const QString &message);
54
58 QString usernameField() const;
59
63 void setUsernameField(const QString &fieldName);
64
68 QString passwordField() const;
69
73 void setPasswordField(const QString &fieldName);
74
78 PasswordType passwordType() const;
79
83 void setPasswordType(PasswordType type);
84
89
94
99
104
110 void setRequireSsl(bool require);
111
113 authenticate(Context *c, AuthenticationRealm *realm, const ParamsMultiMap &authinfo) final;
114
115protected:
116 CredentialHttpPrivate *d_ptr;
117};
118
119} // namespace Cutelyst
120
121#endif // CREDENTIALHTTP_H
AuthenticationCredential(QObject *parent=nullptr)
Constructs a new AuthenticationCredential object with the given parent.
The Cutelyst Context.
Definition context.h:39
QString usernameField() const
Returns the field to look for when authenticating the user.
void setPasswordType(PasswordType type)
Sets the type of password this class will be dealing with.
void setUsernameField(const QString &fieldName)
Sets the field to look for when authenticating the user.
QString passwordPreSalt() const
Returns the salt string to be prepended to the password.
QString passwordPostSalt() const
Returns the salt string to be appended to the password.
void setPasswordPreSalt(const QString &passwordPreSalt)
Sets the salt string to be prepended to the password.
QString passwordField() const
Returns the field to look for when authenticating the user.
PasswordType passwordType() const
Returns the type of password this class will be dealing with.
void setType(CredentialHttp::AuthType type)
CredentialHttp(QObject *parent=nullptr)
Constructs a new CredentialHttp object with the given parent.
AuthenticationUser authenticate(Context *c, AuthenticationRealm *realm, const ParamsMultiMap &authinfo) final
Tries to authenticate the authinfo using the give realm.
void setPasswordField(const QString &fieldName)
Sets the field to look for when authenticating the user.
void setPasswordPostSalt(const QString &passwordPostSalt)
Sets the salt string to be appended to the password.
void setRequireSsl(bool require)
void setAuthorizationRequiredMessage(const QString &message)
The Cutelyst namespace holds all public Cutelyst API.
Definition Mainpage.dox:8
QMultiMap< QString, QString > ParamsMultiMap
QObject(QObject *parent)
Q_ENUM(...)
Q_OBJECTQ_OBJECT
QObject * parent() const const