Cutelyst  2.13.0
credentialhttp.h
1 /*
2  * Copyright (C) 2013-2018 Daniel Nicoletti <dantti12@gmail.com>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18 #ifndef CREDENTIALHTTP_H
19 #define CREDENTIALHTTP_H
20 
21 #include <QtCore/QCryptographicHash>
22 
23 #include <Cutelyst/cutelyst_global.h>
24 #include <Cutelyst/Plugins/Authentication/authentication.h>
25 
26 namespace Cutelyst {
27 
28 class CredentialHttpPrivate;
29 class CUTELYST_PLUGIN_AUTHENTICATION_EXPORT CredentialHttp : public AuthenticationCredential
30 {
31  Q_OBJECT
32  Q_DECLARE_PRIVATE(CredentialHttp)
33 public:
34  enum PasswordType {
35  None,
36  Clear,
37  Hashed
38  };
39  Q_ENUM(PasswordType)
40 
41  enum AuthType {
42  Any,
43  Basic
44  };
45  Q_ENUM(AuthType)
46 
47 
50  explicit CredentialHttp(QObject *parent = nullptr);
51  virtual ~CredentialHttp();
52 
59  void setType(CredentialHttp::AuthType type);
60 
66  void setAuthorizationRequiredMessage(const QString &message);
67 
71  QString usernameField() const;
72 
76  void setUsernameField(const QString &fieldName);
77 
81  QString passwordField() const;
82 
86  void setPasswordField(const QString &fieldName);
87 
91  PasswordType passwordType() const;
92 
96  void setPasswordType(PasswordType type);
97 
101  QString passwordPreSalt() const;
102 
106  void setPasswordPreSalt(const QString &passwordPreSalt);
107 
111  QString passwordPostSalt() const;
112 
116  void setPasswordPostSalt(const QString &passwordPostSalt);
117 
123  void setRequireSsl(bool require);
124 
125  AuthenticationUser authenticate(Context *c, AuthenticationRealm *realm, const ParamsMultiMap &authinfo) final;
126 
127 protected:
128  CredentialHttpPrivate *d_ptr;
129 
130 };
131 
132 }
133 
134 #endif // CREDENTIALHTTP_H
Cutelyst::ParamsMultiMap
QMap< QString, QString > ParamsMultiMap
Definition: paramsmultimap.h:36
Cutelyst::AuthenticationCredential
Definition: authentication.h:31
Cutelyst::Context
The Cutelyst Context.
Definition: context.h:50
Cutelyst::AuthenticationUser
Definition: authenticationuser.h:31
Cutelyst::AuthenticationRealm
Definition: authenticationrealm.h:30
Cutelyst::CredentialHttp
Definition: credentialhttp.h:29
Cutelyst
The Cutelyst namespace holds all public Cutelyst API.
Definition: Mainpage.dox:7