cutelyst 4.3.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#include <Cutelyst/cutelyst_global.h>
9
10#include <QtCore/QCryptographicHash>
11
12namespace Cutelyst {
13
14class CredentialHttpPrivate;
15
33class CUTELYST_PLUGIN_AUTHENTICATION_EXPORT CredentialHttp : public AuthenticationCredential
34{
35 Q_OBJECT
36 Q_DECLARE_PRIVATE(CredentialHttp)
37public:
44 Hashed
46 };
47 Q_ENUM(PasswordType)
48
49
52 enum AuthType {
53 Any,
54 Basic,
55 };
56 Q_ENUM(AuthType)
57
58
61 explicit CredentialHttp(QObject *parent = nullptr);
62
66 virtual ~CredentialHttp();
67
74 void setType(CredentialHttp::AuthType type);
75
81 void setAuthorizationRequiredMessage(const QString &message);
82
86 [[nodiscard]] QString usernameField() const;
87
91 void setUsernameField(const QString &fieldName);
92
96 [[nodiscard]] QString passwordField() const;
97
101 void setPasswordField(const QString &fieldName);
102
106 [[nodiscard]] PasswordType passwordType() const;
107
111 void setPasswordType(PasswordType type);
112
116 [[nodiscard]] QString passwordPreSalt() const;
117
121 void setPasswordPreSalt(const QString &passwordPreSalt);
122
126 [[nodiscard]] QString passwordPostSalt() const;
127
131 void setPasswordPostSalt(const QString &passwordPostSalt);
132
138 void setRequireSsl(bool require);
139
147 [[nodiscard]] AuthenticationUser
148 authenticate(Context *c, AuthenticationRealm *realm, const ParamsMultiMap &authinfo) final;
149
150protected:
151 CredentialHttpPrivate *d_ptr;
152};
153
154} // 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.