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.
59 lines
1.4 KiB
59 lines
1.4 KiB
14 years ago
|
/*! @file
|
||
|
|
||
|
@id $Id$
|
||
|
*/
|
||
|
// 1 2 3 4 5 6 7 8
|
||
|
// 45678901234567890123456789012345678901234567890123456789012345678901234567890
|
||
|
#include <QtNetwork/QNetworkReply>
|
||
|
#include <QtNetwork/QNetworkAccessManager>
|
||
14 years ago
|
#include <smartcardauth.hxx>
|
||
14 years ago
|
|
||
|
#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;
|
||
|
}
|
||
|
|
||
14 years ago
|
void scAuth(SmartCardAuth* auth) {
|
||
|
_scAuth = std::auto_ptr<SmartCardAuth>(auth);
|
||
|
}
|
||
|
|
||
14 years ago
|
Q_SIGNALS:
|
||
|
|
||
|
void created(QNetworkReply*);
|
||
|
|
||
|
protected:
|
||
|
|
||
|
virtual QNetworkReply* createRequest(Operation op,
|
||
|
const QNetworkRequest& req,
|
||
|
QIODevice* outgoingData = 0 ) {
|
||
|
LOG<<req.url();
|
||
14 years ago
|
if (req.url().scheme()=="https") {
|
||
|
LOG<<"Need to login";
|
||
|
if (_scAuth.get()) _scAuth->login(false);
|
||
|
}
|
||
14 years ago
|
QNetworkReply* rep
|
||
|
(QNetworkAccessManager::createRequest(op, req, outgoingData));
|
||
|
created(rep);
|
||
|
LOG<<"Reply to URL: "<<rep->url().toString();
|
||
|
return rep;
|
||
|
}
|
||
|
|
||
14 years ago
|
private:
|
||
|
|
||
|
std::auto_ptr<SmartCardAuth> _scAuth;
|
||
|
|
||
14 years ago
|
};
|