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