QGIS API Documentation  2.2.0-Valmiera
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
qgscredentials.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgscredentials.h - interface for requesting credentials
3  ----------------------
4  begin : Feburary 2010
5  copyright : (C) 2010 by Juergen E. Fischer
6  email : jef at norbit dot de
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 
16 
17 #ifndef QGSCREDENTIALS_H
18 #define QGSCREDENTIALS_H
19 
20 #include <QString>
21 #include <QObject>
22 #include <QPair>
23 #include <QMap>
24 
36 class CORE_EXPORT QgsCredentials
37 {
38  public:
40  virtual ~QgsCredentials();
41 
42  bool get( QString realm, QString &username, QString &password, QString message = QString::null );
43  void put( QString realm, QString username, QString password );
44 
46  static QgsCredentials *instance();
47 
48  protected:
50  virtual bool request( QString realm, QString &username, QString &password, QString message = QString::null ) = 0;
51 
53  void setInstance( QgsCredentials *theInstance );
54 
55  private:
57  QMap< QString, QPair<QString, QString> > mCredentialCache;
58 
61 };
62 
63 
71 class CORE_EXPORT QgsCredentialsConsole : public QObject, public QgsCredentials
72 {
73  Q_OBJECT
74 
75  public:
77 
78  signals:
80  void destroyed();
81 
82  protected:
83  virtual bool request( QString realm, QString &username, QString &password, QString message = QString::null );
84 };
85 
86 #endif