cutelyst 4.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#include <Cutelyst/cutelyst_global.h>
9
10#include <QtCore/QCryptographicHash>
11
12namespace Cutelyst {
13
14class CredentialHttpPrivate;
15class CUTELYST_PLUGIN_AUTHENTICATION_EXPORT CredentialHttp : public AuthenticationCredential
16{
17 Q_OBJECT
18 Q_DECLARE_PRIVATE(CredentialHttp)
19public:
20 enum PasswordType {
21 None,
22 Clear,
23 Hashed,
24 };
25 Q_ENUM(PasswordType)
26
27 enum AuthType {
28 Any,
29 Basic,
30 };
31 Q_ENUM(AuthType)
32
33
36 explicit CredentialHttp(QObject *parent = nullptr);
37 virtual ~CredentialHttp();
38
45 void setType(CredentialHttp::AuthType type);
46
52 void setAuthorizationRequiredMessage(const QString &message);
53
57 [[nodiscard]] QString usernameField() const;
58
62 void setUsernameField(const QString &fieldName);
63
67 [[nodiscard]] QString passwordField() const;
68
72 void setPasswordField(const QString &fieldName);
73
77 [[nodiscard]] PasswordType passwordType() const;
78
82 void setPasswordType(PasswordType type);
83
87 [[nodiscard]] QString passwordPreSalt() const;
88
92 void setPasswordPreSalt(const QString &passwordPreSalt);
93
97 [[nodiscard]] QString passwordPostSalt() const;
98
102 void setPasswordPostSalt(const QString &passwordPostSalt);
103
109 void setRequireSsl(bool require);
110
111 [[nodiscard]] AuthenticationUser
112 authenticate(Context *c, AuthenticationRealm *realm, const ParamsMultiMap &authinfo) final;
113
114protected:
115 CredentialHttpPrivate *d_ptr;
116};
117
118} // namespace Cutelyst
The Cutelyst Context.
Definition: context.h:38
The Cutelyst namespace holds all public Cutelyst API.
Definition: Mainpage.dox:8
QMultiMap< QString, QString > ParamsMultiMap