1 /****************************************************************************
2 ** Copyright (C) 2010-2020 Klaralvdalens Datakonsult AB, a KDAB Group company, info@kdab.com.
3 ** All rights reserved.
4 **
5 ** This file is part of the KD Soap library.
6 **
7 ** Licensees holding valid commercial KD Soap licenses may use this file in
8 ** accordance with the KD Soap Commercial License Agreement provided with
9 ** the Software.
10 **
11 **
12 ** This file may be distributed and/or modified under the terms of the
13 ** GNU Lesser General Public License version 2.1 and version 3 as published by the
14 ** Free Software Foundation and appearing in the file LICENSE.LGPL.txt included.
15 **
16 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
17 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
18 **
19 ** Contact info@kdab.com if any conditions of this licensing are not
20 ** clear to you.
21 **
22 **********************************************************************/
23 #ifndef KDSOAPSERVERAUTHINTERFACE_H
24 #define KDSOAPSERVERAUTHINTERFACE_H
25 
26 #include "KDSoapServerGlobal.h"
27 #include <QtCore/QObject>
28 class KDSoapAuthentication;
29 class KDSoapServerSocket;
30 
31 /**
32  * Additional interface for handling authentication.
33  *
34  * In addition to deriving from KDSoapServerObjectInterface, you can derive from
35  * KDSoapServerAuthInterface in order to handle HTTP authentication.
36  *
37  * Use Q_INTERFACES(KDSoapServerAuthInterface) in your derived class (under Q_OBJECT)
38  * so that Qt can discover the additional inheritance.
39  *
40  * \since 1.3
41  */
42 class KDSOAPSERVER_EXPORT KDSoapServerAuthInterface
43 {
44 public:
45     /**
46      * Constructor
47      */
48     KDSoapServerAuthInterface();
49 
50     /**
51      * Destructor
52      */
53     virtual ~KDSoapServerAuthInterface();
54 
55     /**
56      * Return true if the authentication details are valid.
57      */
58     virtual bool validateAuthentication(const KDSoapAuthentication &auth, const QString &path);
59 
60 private:
61     friend class KDSoapServerSocket;
62     bool handleHttpAuth(const QByteArray &authValue, const QString &path);
63     class Private;
64     Private *const d;
65 };
66 
67 QT_BEGIN_NAMESPACE
68 Q_DECLARE_INTERFACE(KDSoapServerAuthInterface,
69                     "com.kdab.KDSoap.ServerAuthInterface/1.0")
70 QT_END_NAMESPACE
71 
72 #endif /* KDSOAPSERVERAUTHINTERFACE_H */
73