|
@@ -25,6 +25,7 @@ |
|
|
#include <QSslConfiguration> |
|
|
#include <QSslError> |
|
|
#endif |
|
|
#include <QMutexLocker> |
|
|
|
|
|
#include "qgsauthcertutils.h" |
|
|
#include "qgsauthmanager.h" |
|
@@ -51,8 +52,9 @@ QgsAuthIdentCertMethod::QgsAuthIdentCertMethod() |
|
|
|
|
|
QgsAuthIdentCertMethod::~QgsAuthIdentCertMethod() |
|
|
{ |
|
|
qDeleteAll( mPkiConfigBundleCache ); |
|
|
mPkiConfigBundleCache.clear(); |
|
|
QMutexLocker locker( &mConfigMutex ); |
|
|
qDeleteAll( sPkiConfigBundleCache ); |
|
|
sPkiConfigBundleCache.clear(); |
|
|
} |
|
|
|
|
|
QString QgsAuthIdentCertMethod::key() const |
|
@@ -220,7 +222,8 @@ void QgsAuthIdentCertMethod::updateMethodConfig( QgsAuthMethodConfig &mconfig ) |
|
|
|
|
|
QgsPkiConfigBundle *QgsAuthIdentCertMethod::getPkiConfigBundle( const QString &authcfg ) |
|
|
{ |
|
|
QgsPkiConfigBundle * bundle = nullptr; |
|
|
QMutexLocker locker( &mConfigMutex ); |
|
|
QgsPkiConfigBundle *bundle = nullptr; |
|
|
|
|
|
// check if it is cached |
|
|
if ( mPkiConfigBundleCache.contains( authcfg ) ) |
|
@@ -264,6 +267,7 @@ QgsPkiConfigBundle *QgsAuthIdentCertMethod::getPkiConfigBundle( const QString &a |
|
|
|
|
|
bundle = new QgsPkiConfigBundle( mconfig, clientcert, clientkey ); |
|
|
|
|
|
locker.unlock(); |
|
|
// cache bundle |
|
|
putPkiConfigBundle( authcfg, bundle ); |
|
|
|
|
@@ -272,13 +276,15 @@ QgsPkiConfigBundle *QgsAuthIdentCertMethod::getPkiConfigBundle( const QString &a |
|
|
|
|
|
void QgsAuthIdentCertMethod::putPkiConfigBundle( const QString &authcfg, QgsPkiConfigBundle *pkibundle ) |
|
|
{ |
|
|
QMutexLocker locker( &mConfigMutex ); |
|
|
QgsDebugMsg( QString( "Putting PKI bundle for authcfg %1" ).arg( authcfg ) ); |
|
|
mPkiConfigBundleCache.insert( authcfg, pkibundle ); |
|
|
} |
|
|
|
|
|
void QgsAuthIdentCertMethod::removePkiConfigBundle( const QString &authcfg ) |
|
|
{ |
|
|
if ( mPkiConfigBundleCache.contains( authcfg ) ) |
|
|
QMutexLocker locker( &mConfigMutex ); |
|
|
if ( sPkiConfigBundleCache.contains( authcfg ) ) |
|
|
{ |
|
|
QgsPkiConfigBundle * pkibundle = mPkiConfigBundleCache.take( authcfg ); |
|
|
delete pkibundle; |
|
|