Cutelyst  1.7.0
credentialhttp.h
1 /*
2  * Copyright (C) 2013-2015 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 Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 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  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public License
15  * along with this library; see the file COPYING.LIB. If not, write to
16  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  * Boston, MA 02110-1301, USA.
18  */
19 
20 #ifndef CREDENTIALHTTP_H
21 #define CREDENTIALHTTP_H
22 
23 #include <QtCore/QCryptographicHash>
24 
25 #include <Cutelyst/cutelyst_global.h>
26 #include <Cutelyst/Plugins/Authentication/authentication.h>
27 
28 namespace Cutelyst {
29 
30 class CredentialHttpPrivate;
31 class CUTELYST_PLUGIN_AUTHENTICATION_EXPORT CredentialHttp : public AuthenticationCredential
32 {
33  Q_OBJECT
34  Q_DECLARE_PRIVATE(CredentialHttp)
35 public:
36  enum PasswordType {
37  None,
38  Clear,
39  Hashed,
40  SelfCheck
41  };
42  Q_ENUM(PasswordType)
43 
44  enum AuthType {
45  Any,
46  Digest,
47  Basic
48  };
49  Q_ENUM(AuthType)
50 
51 
54  explicit CredentialHttp(QObject *parent = nullptr);
55  virtual ~CredentialHttp();
56 
63  void setType(CredentialHttp::AuthType type);
64 
70  void setAuthorizationRequiredMessage(const QString &message);
71 
75  QString usernameField() const;
76 
80  void setUsernameField(const QString &fieldName);
81 
85  QString passwordField() const;
86 
90  void setPasswordField(const QString &fieldName);
91 
95  PasswordType passwordType() const;
96 
100  void setPasswordType(PasswordType type);
101 
105  QString passwordPreSalt() const;
106 
110  void setPasswordPreSalt(const QString &passwordPreSalt);
111 
115  QString passwordPostSalt() const;
116 
120  void setPasswordPostSalt(const QString &passwordPostSalt);
121 
127  void setRequireSsl(bool require);
128 
129  AuthenticationUser authenticate(Context *c, AuthenticationRealm *realm, const ParamsMultiMap &authinfo) final;
130 
131 protected:
132  CredentialHttpPrivate *d_ptr;
133 
134 };
135 
136 }
137 
138 #endif // CREDENTIALHTTP_H
QMap< QString, QString > ParamsMultiMap
The Cutelyst Context.
Definition: context.h:52
The Cutelyst namespace holds all public Cutelyst API.
Definition: Mainpage.dox:7