You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
58 lines
1.4 KiB
58 lines
1.4 KiB
/*! @file |
|
|
|
@id $Id$ |
|
*/ |
|
// 1 2 3 4 5 6 7 8 |
|
// 45678901234567890123456789012345678901234567890123456789012345678901234567890 |
|
#include <QtNetwork/QNetworkReply> |
|
#include <QtNetwork/QNetworkAccessManager> |
|
#include <smartcardauth.hxx> |
|
|
|
#include <QtCore/QDebug> |
|
#ifndef LOG |
|
#define LOG qDebug()<<__PRETTY_FUNCTION__ |
|
#endif |
|
|
|
class SslClientAuthNetworkAccessManager: public QNetworkAccessManager { |
|
Q_OBJECT; |
|
public: |
|
|
|
SslClientAuthNetworkAccessManager(QObject* parent = 0): |
|
QNetworkAccessManager(parent) { |
|
LOG; |
|
} |
|
|
|
virtual ~SslClientAuthNetworkAccessManager() { |
|
LOG; |
|
} |
|
|
|
void scAuth(SmartCardAuth* auth) { |
|
_scAuth = std::auto_ptr<SmartCardAuth>(auth); |
|
} |
|
|
|
Q_SIGNALS: |
|
|
|
void created(QNetworkReply*); |
|
|
|
protected: |
|
|
|
virtual QNetworkReply* createRequest(Operation op, |
|
const QNetworkRequest& req, |
|
QIODevice* outgoingData = 0 ) { |
|
LOG<<req.url(); |
|
if (req.url().scheme()=="https") { |
|
LOG<<"Need to login"; |
|
if (_scAuth.get()) _scAuth->login(false); |
|
} |
|
QNetworkReply* rep |
|
(QNetworkAccessManager::createRequest(op, req, outgoingData)); |
|
created(rep); |
|
LOG<<"Reply to URL: "<<rep->url().toString(); |
|
return rep; |
|
} |
|
|
|
private: |
|
|
|
std::auto_ptr<SmartCardAuth> _scAuth; |
|
|
|
};
|
|
|