Cutelyst  1.5.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  explicit CredentialHttp(QObject *parent = nullptr);
51  virtual ~CredentialHttp();
52 
59  void setType(CredentialHttp::AuthType type);
60 
66  void setAuthorizationRequiredMessage(const QString &message);
67 
68  QString passwordField() const;
69  void setPasswordField(const QString &fieldName);
70 
71  PasswordType passwordType() const;
72  void setPasswordType(PasswordType type);
73 
74  QString passwordPreSalt() const;
75  void setPasswordPreSalt(const QString &passwordPreSalt);
76 
77  QString passwordPostSalt() const;
78  void setPasswordPostSalt(const QString &passwordPostSalt);
79 
80  QString usernameField() const;
81  void setUsernameField(const QString &fieldName);
82 
88  void setRequireSsl(bool require);
89 
90  AuthenticationUser authenticate(Context *c, AuthenticationRealm *realm, const ParamsMultiMap &authinfo) final;
91 
92 protected:
93  CredentialHttpPrivate *d_ptr;
94 
95 };
96 
97 }
98 
99 #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