cutelyst 5.0.0
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-2023 Daniel Nicoletti <dantti12@gmail.com>
3 * SPDX-License-Identifier: BSD-3-Clause
4 */
5#pragma once
6
7#include <Cutelyst/Plugins/Authentication/authentication.h>
8
9#include <QtCore/QCryptographicHash>
10
11namespace Cutelyst {
12
13class CredentialHttpPrivate;
14
32class CUTELYST_PLUGIN_AUTHENTICATION_EXPORT CredentialHttp : public AuthenticationCredential
33{
34 Q_OBJECT
35 Q_DECLARE_PRIVATE(CredentialHttp)
36public:
43 Hashed
45 };
46 Q_ENUM(PasswordType)
47
48
51 enum AuthType {
52 Any,
53 Basic,
54 };
55 Q_ENUM(AuthType)
56
57
60 explicit CredentialHttp(QObject *parent = nullptr);
61
65 virtual ~CredentialHttp();
66
73 void setType(CredentialHttp::AuthType type);
74
80 void setAuthorizationRequiredMessage(const QString &message);
81
85 [[nodiscard]] QString usernameField() const;
86
90 void setUsernameField(const QString &fieldName);
91
95 [[nodiscard]] QString passwordField() const;
96
100 void setPasswordField(const QString &fieldName);
101
105 [[nodiscard]] PasswordType passwordType() const;
106
110 void setPasswordType(PasswordType type);
111
115 [[nodiscard]] QString passwordPreSalt() const;
116
120 void setPasswordPreSalt(const QString &passwordPreSalt);
121
125 [[nodiscard]] QString passwordPostSalt() const;
126
130 void setPasswordPostSalt(const QString &passwordPostSalt);
131
137 void setRequireSsl(bool require);
138
146 [[nodiscard]] AuthenticationUser
147 authenticate(Context *c, AuthenticationRealm *realm, const ParamsMultiMap &authinfo) final;
148
149protected:
150 CredentialHttpPrivate *d_ptr;
151};
152
153} // namespace Cutelyst
Abstract class to validate authentication credentials like user name and password.
Combines user store and credential validation into a named realm.
Container for user data retrieved from an AuthenticationStore.
The Cutelyst Context.
Definition context.h:42
Use HTTP basic authentication to authenticate a user.
The Cutelyst namespace holds all public Cutelyst API.