1 /***************************************************************************
2     qgsauthpkipathsmethod.h
3     ---------------------
4     begin                : September 1, 2015
5     copyright            : (C) 2015 by Boundless Spatial, Inc. USA
6     author               : Larry Shaffer
7     email                : lshaffer at boundlessgeo dot com
8  ***************************************************************************
9  *                                                                         *
10  *   This program is free software; you can redistribute it and/or modify  *
11  *   it under the terms of the GNU General Public License as published by  *
12  *   the Free Software Foundation; either version 2 of the License, or     *
13  *   (at your option) any later version.                                   *
14  *                                                                         *
15  ***************************************************************************/
16 
17 #ifndef QGSAUTHPKIPATHSMETHOD_H
18 #define QGSAUTHPKIPATHSMETHOD_H
19 
20 #include <QObject>
21 #include <QMutex>
22 
23 #include "qgsauthconfig.h"
24 #include "qgsauthmethod.h"
25 #include "qgsauthmethodmetadata.h"
26 
27 
28 class QgsAuthPkiPathsMethod : public QgsAuthMethod
29 {
30     Q_OBJECT
31 
32   public:
33 
34     static const QString AUTH_METHOD_KEY;
35     static const QString AUTH_METHOD_DESCRIPTION;
36     static const QString AUTH_METHOD_DISPLAY_DESCRIPTION;
37 
38     explicit QgsAuthPkiPathsMethod();
39     ~QgsAuthPkiPathsMethod() override;
40 
41     // QgsAuthMethod interface
42     QString key() const override;
43 
44     QString description() const override;
45 
46     QString displayDescription() const override;
47 
48     bool updateNetworkRequest( QNetworkRequest &request, const QString &authcfg,
49                                const QString &dataprovider = QString() ) override;
50 
51     bool updateDataSourceUriItems( QStringList &connectionItems, const QString &authcfg,
52                                    const QString &dataprovider = QString() ) override;
53 
54     void clearCachedConfig( const QString &authcfg ) override;
55 
56     void updateMethodConfig( QgsAuthMethodConfig &mconfig ) override;
57 
58 #ifdef HAVE_GUI
59     QWidget *editWidget( QWidget *parent )const override;
60 #endif
61 
62   private:
63 
64     QgsPkiConfigBundle *getPkiConfigBundle( const QString &authcfg );
65 
66     void putPkiConfigBundle( const QString &authcfg, QgsPkiConfigBundle *pkibundle );
67 
68     void removePkiConfigBundle( const QString &authcfg );
69 
70     static QMap<QString, QgsPkiConfigBundle *> sPkiConfigBundleCache;
71 
72 };
73 
74 
75 class QgsAuthPkiPathsMethodMetadata : public QgsAuthMethodMetadata
76 {
77   public:
QgsAuthPkiPathsMethodMetadata()78     QgsAuthPkiPathsMethodMetadata()
79       : QgsAuthMethodMetadata( QgsAuthPkiPathsMethod::AUTH_METHOD_KEY, QgsAuthPkiPathsMethod::AUTH_METHOD_DESCRIPTION )
80     {}
createAuthMethod()81     QgsAuthPkiPathsMethod *createAuthMethod() const override {return new QgsAuthPkiPathsMethod;}
82     //QStringList supportedDataProviders() const override;
83 };
84 
85 
86 #endif // QGSAUTHPKIPATHSMETHOD_H
87