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 
13 namespace Cutelyst {
14 
15 class CredentialHttpPrivate;
16 class CUTELYST_PLUGIN_AUTHENTICATION_EXPORT CredentialHttp : public AuthenticationCredential
17 {
18  Q_OBJECT
19  Q_DECLARE_PRIVATE(CredentialHttp)
20 public:
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 
88  QString passwordPreSalt() const;
89 
93  void setPasswordPreSalt(const QString &passwordPreSalt);
94 
98  QString passwordPostSalt() const;
99 
103  void setPasswordPostSalt(const QString &passwordPostSalt);
104 
110  void setRequireSsl(bool require);
111 
113  authenticate(Context *c, AuthenticationRealm *realm, const ParamsMultiMap &authinfo) final;
114 
115 protected:
116  CredentialHttpPrivate *d_ptr;
117 };
118 
119 } // namespace Cutelyst
120 
121 #endif // CREDENTIALHTTP_H
The Cutelyst Context.
Definition: context.h:38
The Cutelyst namespace holds all public Cutelyst API.
Definition: Mainpage.dox:7