Skip to content
Permalink
Browse files

Merge pull request #5480 from boundlessgeo/auth_get_removal

[api][auth] Removed get prefix from all getters in auth manager
  • Loading branch information
elpaso committed Oct 27, 2017
2 parents 2fdf30c + d64529f commit 8ef715be1568365f37f7071cd074604d022df997
@@ -539,6 +539,30 @@ QgsAuthManager {#qgis_api_break_3_0_QgsAuthManager}
- scheduledAuthDbErase() was renamed to scheduledAuthDatabaseErase()
- setScheduledAuthDbErase() was renamed to setScheduledAuthDatabaseErase()
- setScheduledAuthDbEraseRequestEmitted() was renamed to setScheduledAuthDatabaseEraseRequestEmitted()
- getAuthSetting() was renamed to authSetting()
- getCertIdentity() was renamed to certIdentity()
- getCertIdentityBundle() was renamed to certIdentityBundle()
- getCertIdentityBundleToPem() was renamed to certIdentityBundleToPem()
- getCertIdentities() was renamed to certIdentities()
- getCertIdentityIds() was renamed to certIdentityIds()
- getSslCertCustomConfig() was renamed to sslCertCustomConfig()
- getSslCertCustomConfigByHost() was renamed to sslCertCustomConfigByHost()
- getSslCertCustomConfigs() was renamed to sslCertCustomConfigs()
- getIgnoredSslErrorCache() was renamed to ignoredSslErrorCache()
- getCertAuthority() was renamed to certAuthority()
- getSystemRootCAs() was renamed to systemRootCAs()
- getExtraFileCAs() was renamed to extraFileCAs()
- getDatabaseCAs() was renamed to databaseCAs()
- getMappedDatabaseCAs() was renamed to mappedDatabaseCAs()
- getCaCertsCache() was renamed to caCertsCache()
- getCertTrustPolicy() was renamed to certTrustPolicy()
- getCertificateTrustPolicy() was renamed to certificateTrustPolicy()
- getCertTrustCache() was renamed to certTrustCache()
- getTrustedCaCerts() was renamed to trustedCaCerts()
- getUntrustedCaCerts() was renamed to untrustedCaCerts()
- getTrustedCaCertsCache() was renamed to trustedCaCertsCache()
- getTrustedCaCertsPemText() was renamed to trustedCaCertsPemText()



QgsAuthMethod {#qgis_api_break_3_0_QgsAuthMethod}
@@ -374,9 +374,14 @@ Store an authentication setting (stored as string via QVariant( value ).toString
:rtype: bool
%End

QVariant getAuthSetting( const QString &key, const QVariant &defaultValue = QVariant(), bool decrypt = false );
%Docstring
Get an authentication setting (retrieved as string and returned as QVariant( QString ))
QVariant authSetting( const QString &key, const QVariant &defaultValue = QVariant(), bool decrypt = false );
%Docstring
authSetting get an authentication setting (retrieved as string and returned as QVariant( QString ))
\param key setting key
\param defaultValue
\param decrypt if the value needs decrypted
:return: QVariant( QString ) authentication setting
.. versionadded:: 3.0
:rtype: QVariant
%End

@@ -405,28 +410,39 @@ Store a certificate identity
:rtype: bool
%End

const QSslCertificate getCertIdentity( const QString &id );
const QSslCertificate certIdentity( const QString &id );
%Docstring
Get a certificate identity by id (sha hash)
certIdentity get a certificate identity by ``id`` (sha hash)
\param id sha hash of the cert
:return: the certificate
.. versionadded:: 3.0
:rtype: QSslCertificate
%End


const QStringList getCertIdentityBundleToPem( const QString &id );
const QStringList certIdentityBundleToPem( const QString &id );
%Docstring
Get a certificate identity bundle by id (sha hash) returned as PEM text
certIdentityBundleToPem get a certificate identity bundle by ``id`` (sha hash) returned as PEM text
\param id sha hash
:return: a list of strings
.. versionadded:: 3.0
:rtype: list of str
%End

const QList<QSslCertificate> getCertIdentities();
const QList<QSslCertificate> certIdentities();
%Docstring
Get certificate identities
certIdentities get certificate identities
:return: list of certificates
.. versionadded:: 3.0
:rtype: list of QSslCertificate
%End

QStringList getCertIdentityIds() const;

QStringList certIdentityIds() const;
%Docstring
Get list of certificate identity ids from database
certIdentityIds get list of certificate identity ids from database
:return: list of certificate ids
.. versionadded:: 3.0
:rtype: list of str
%End

@@ -449,21 +465,30 @@ Store an SSL certificate custom config
:rtype: bool
%End

const QgsAuthConfigSslServer getSslCertCustomConfig( const QString &id, const QString &hostport );
const QgsAuthConfigSslServer sslCertCustomConfig( const QString &id, const QString &hostport );
%Docstring
Get an SSL certificate custom config by id (sha hash) and host:port
sslCertCustomConfig get an SSL certificate custom config by ``id`` (sha hash) and ``hostport`` (host:port)
\param id sha hash
\param hostport string host:port
:return: a SSL certificate custom config
.. versionadded:: 3.0
:rtype: QgsAuthConfigSslServer
%End

const QgsAuthConfigSslServer getSslCertCustomConfigByHost( const QString &hostport );
const QgsAuthConfigSslServer sslCertCustomConfigByHost( const QString &hostport );
%Docstring
Get an SSL certificate custom config by host:port
sslCertCustomConfigByHost get an SSL certificate custom config by ``hostport`` (host:port)
\param hostport host:port
:return: a SSL certificate custom config
.. versionadded:: 3.0
:rtype: QgsAuthConfigSslServer
%End

const QList<QgsAuthConfigSslServer> getSslCertCustomConfigs();
const QList<QgsAuthConfigSslServer> sslCertCustomConfigs();
%Docstring
Get SSL certificate custom configs
sslCertCustomConfigs get SSL certificate custom configs
:return: list of SSL certificate custom config
.. versionadded:: 3.0
:rtype: list of QgsAuthConfigSslServer
%End

@@ -516,9 +541,13 @@ Store a certificate authority
:rtype: bool
%End

const QSslCertificate getCertAuthority( const QString &id );

const QSslCertificate certAuthority( const QString &id );
%Docstring
Get a certificate authority by id (sha hash)
certAuthority get a certificate authority by ``id`` (sha hash)
\param id sha hash
:return: a certificate
.. versionadded:: 3.0
:rtype: QSslCertificate
%End

@@ -534,27 +563,35 @@ Remove a certificate authority
:rtype: bool
%End

const QList<QSslCertificate> getSystemRootCAs();
const QList<QSslCertificate> systemRootCAs();
%Docstring
Get root system certificate authorities
systemRootCAs get root system certificate authorities
:return: list of certificate authorities
.. versionadded:: 3.0
:rtype: list of QSslCertificate
%End

const QList<QSslCertificate> getExtraFileCAs();
const QList<QSslCertificate> extraFileCAs();
%Docstring
Get extra file-based certificate authorities
extraFileCAs extra file-based certificate authorities
:return: list of certificate authorities
.. versionadded:: 3.0
:rtype: list of QSslCertificate
%End

const QList<QSslCertificate> getDatabaseCAs();
const QList<QSslCertificate> databaseCAs();
%Docstring
Get database-stored certificate authorities
databaseCAs get database-stored certificate authorities
:return: list of certificate authorities
.. versionadded:: 3.0
:rtype: list of QSslCertificate
%End

const QMap<QString, QSslCertificate> getMappedDatabaseCAs();
const QMap<QString, QSslCertificate> mappedDatabaseCAs();
%Docstring
Get sha1-mapped database-stored certificate authorities
mappedDatabaseCAs get sha1-mapped database-stored certificate authorities
:return: sha1-mapped certificate authorities
.. versionadded:: 3.0
:rtype: QMap<str, QSslCertificate>
%End

@@ -571,10 +608,12 @@ Store user trust value for a certificate
:rtype: bool
%End

QgsAuthCertUtils::CertTrustPolicy getCertTrustPolicy( const QSslCertificate &cert );
QgsAuthCertUtils::CertTrustPolicy certTrustPolicy( const QSslCertificate &cert );
%Docstring
Get a whether certificate is trusted by user
:return: DefaultTrust if certificate sha not in trust table, i.e. follows default trust policy
certTrustPolicy get whether certificate ``cert`` is trusted by user
\param cert
:return: DefaultTrust if certificate sha not in trust table, i.e. follows default trust policy
.. versionadded:: 3.0
:rtype: QgsAuthCertUtils.CertTrustPolicy
%End

@@ -590,9 +629,12 @@ Remove a certificate authority
:rtype: bool
%End

QgsAuthCertUtils::CertTrustPolicy getCertificateTrustPolicy( const QSslCertificate &cert );
QgsAuthCertUtils::CertTrustPolicy certificateTrustPolicy( const QSslCertificate &cert );
%Docstring
Get trust policy for a particular certificate
certificateTrustPolicy get trust policy for a particular certificate ``cert``
\param cert
:return: DefaultTrust if certificate sha not in trust table, i.e. follows default trust policy
.. versionadded:: 3.0
:rtype: QgsAuthCertUtils.CertTrustPolicy
%End

@@ -608,9 +650,11 @@ Get the default certificate trust policy perferred by user
:rtype: QgsAuthCertUtils.CertTrustPolicy
%End

const QMap<QgsAuthCertUtils::CertTrustPolicy, QStringList > getCertTrustCache();
const QMap<QgsAuthCertUtils::CertTrustPolicy, QStringList > certTrustCache();
%Docstring
Get cache of certificate sha1s, per trust policy
certTrustCache get cache of certificate sha1s, per trust policy
:return: trust-policy-mapped certificate sha1s
.. versionadded:: 3.0
:rtype: QMap<QgsAuthCertUtils.CertTrustPolicy, list of str >
%End

@@ -620,15 +664,20 @@ Rebuild certificate authority cache
:rtype: bool
%End

const QList<QSslCertificate> getTrustedCaCerts( bool includeinvalid = false );
const QList<QSslCertificate> trustedCaCerts( bool includeinvalid = false );
%Docstring
Get list of all trusted CA certificates
trustedCaCerts get list of all trusted CA certificates
\param includeinvalid whether invalid certs needs to be returned
:return: list of certificates
.. versionadded:: 3.0
:rtype: list of QSslCertificate
%End

const QList<QSslCertificate> getUntrustedCaCerts( QList<QSslCertificate> trustedCAs = QList<QSslCertificate>() );
const QList<QSslCertificate> untrustedCaCerts( QList<QSslCertificate> trustedCAs = QList<QSslCertificate>() );
%Docstring
Get list of all untrusted CA certificates
untrustedCaCerts get list of untrusted certificate authorities
:return: list of certificates
.. versionadded:: 3.0
:rtype: list of QSslCertificate
%End

@@ -638,15 +687,19 @@ Rebuild trusted certificate authorities cache
:rtype: bool
%End

const QList<QSslCertificate> getTrustedCaCertsCache();
const QList<QSslCertificate> trustedCaCertsCache();
%Docstring
Get cache of trusted certificate authorities, ready for network connections
trustedCaCertsCache cache of trusted certificate authorities, ready for network connections
:return: list of certificates
.. versionadded:: 3.0
:rtype: list of QSslCertificate
%End

const QByteArray getTrustedCaCertsPemText();
const QByteArray trustedCaCertsPemText();
%Docstring
Get concatenated string of all trusted CA certificates
trustedCaCertsPemText get concatenated string of all trusted CA certificates
:return: bye array with all PEM encoded trusted CAs
.. versionadded:: 3.0
:rtype: QByteArray
%End

@@ -701,9 +754,9 @@ The display name of the Authentication Manager
%Docstring
Custom logging signal to inform the user about master password <-> password manager interactions
@see QgsMessageLog
@param message Message to send
@param tag Associated tag (title)
@param level Message log level
\param message Message to send
\param tag Associated tag (title)
\param level Message log level
%End


@@ -12659,7 +12659,7 @@ void QgisApp::namSslErrors( QNetworkReply *reply, const QList<QSslError> &errors
QString digest( QgsAuthCertUtils::shaHexForCert( reply->sslConfiguration().peerCertificate() ) );
QString dgsthostport( QStringLiteral( "%1:%2" ).arg( digest, hostport ) );

const QHash<QString, QSet<QSslError::SslError> > &errscache( QgsApplication::authManager()->getIgnoredSslErrorCache() );
const QHash<QString, QSet<QSslError::SslError> > &errscache( QgsApplication::authManager()->ignoredSslErrorCache() );

if ( errscache.contains( dgsthostport ) )
{
@@ -75,7 +75,7 @@ void QgsAuthIdentCertEdit::populateIdentityComboBox()
{
cmbIdentityCert->addItem( tr( "Select identity..." ), "" );

QList<QSslCertificate> certs( QgsApplication::authManager()->getCertIdentities() );
QList<QSslCertificate> certs( QgsApplication::authManager()->certIdentities() );
if ( !certs.isEmpty() )
{
cmbIdentityCert->setIconSize( QSize( 26, 22 ) );
@@ -144,7 +144,7 @@ bool QgsAuthIdentCertMethod::updateDataSourceUriItems( QStringList &connectionIt
// save CAs to temp file
QString caFilePath = QgsAuthCertUtils::pemTextToTempFile(
pkiTempFileBase.arg( QUuid::createUuid().toString() ),
QgsApplication::authManager()->getTrustedCaCertsPemText() );
QgsApplication::authManager()->trustedCaCertsPemText() );
if ( caFilePath.isEmpty() )
{
return false;
@@ -246,7 +246,7 @@ QgsPkiConfigBundle *QgsAuthIdentCertMethod::getPkiConfigBundle( const QString &a
}

// get identity from database
QPair<QSslCertificate, QSslKey> cibundle( QgsApplication::authManager()->getCertIdentityBundle( mconfig.config( QStringLiteral( "certid" ) ) ) );
QPair<QSslCertificate, QSslKey> cibundle( QgsApplication::authManager()->certIdentityBundle( mconfig.config( QStringLiteral( "certid" ) ) ) );

// init client cert
// Note: if this is not valid, no sense continuing
@@ -161,17 +161,17 @@ bool QgsAuthPkiPathsMethod::updateDataSourceUriItems( QStringList &connectionIte
{
if ( pkibundle->config().config( QStringLiteral( "addrootca" ), QStringLiteral( "false" ) ) == QStringLiteral( "true" ) )
{
cas = QgsAuthCertUtils::casMerge( QgsApplication::authManager()->getTrustedCaCerts(), pkibundle->caChain() );
cas = QgsAuthCertUtils::casMerge( QgsApplication::authManager()->trustedCaCerts(), pkibundle->caChain() );
}
else
{
cas = QgsAuthCertUtils::casMerge( QgsApplication::authManager()->getTrustedCaCerts(),
cas = QgsAuthCertUtils::casMerge( QgsApplication::authManager()->trustedCaCerts(),
QgsAuthCertUtils::casRemoveSelfSigned( pkibundle->caChain() ) );
}
}
else
{
cas = QgsApplication::authManager()->getTrustedCaCerts();
cas = QgsApplication::authManager()->trustedCaCerts();
}

// save CAs to temp file
@@ -161,17 +161,17 @@ bool QgsAuthPkcs12Method::updateDataSourceUriItems( QStringList &connectionItems
{
if ( pkibundle->config().config( QStringLiteral( "addrootca" ), QStringLiteral( "false" ) ) == QStringLiteral( "true" ) )
{
cas = QgsAuthCertUtils::casMerge( QgsApplication::authManager()->getTrustedCaCerts(), pkibundle->caChain() );
cas = QgsAuthCertUtils::casMerge( QgsApplication::authManager()->trustedCaCerts(), pkibundle->caChain() );
}
else
{
cas = QgsAuthCertUtils::casMerge( QgsApplication::authManager()->getTrustedCaCerts(),
cas = QgsAuthCertUtils::casMerge( QgsApplication::authManager()->trustedCaCerts(),
QgsAuthCertUtils::casRemoveSelfSigned( pkibundle->caChain() ) );
}
}
else
{
cas = QgsApplication::authManager()->getTrustedCaCerts();
cas = QgsApplication::authManager()->trustedCaCerts();
}

// save CAs to temp file
@@ -947,9 +947,9 @@ QList<QgsAuthCertUtils::CertUsageType> QgsAuthCertUtils::certificateUsageTypes(

// ask QCA what it thinks about potential usages
QCA::CertificateCollection trustedCAs(
qtCertsToQcaCollection( QgsApplication::authManager()->getTrustedCaCertsCache() ) );
qtCertsToQcaCollection( QgsApplication::authManager()->trustedCaCertsCache() ) );
QCA::CertificateCollection untrustedCAs(
qtCertsToQcaCollection( QgsApplication::authManager()->getUntrustedCaCerts() ) );
qtCertsToQcaCollection( QgsApplication::authManager()->untrustedCaCerts() ) );

QCA::Validity v_any;
v_any = qcacert.validate( trustedCAs, untrustedCAs, QCA::UsageAny, QCA::ValidateAll );
@@ -1251,7 +1251,7 @@ QList<QSslError> QgsAuthCertUtils::validateCertChain( const QList<QSslCertificat
for ( const auto &cert : certificateChain )
{
bool untrusted = false;
for ( const auto &untrustedCert : QgsApplication::authManager()->getUntrustedCaCerts() )
for ( const auto &untrustedCert : QgsApplication::authManager()->untrustedCaCerts() )
{
if ( cert.digest( ) == untrustedCert.digest( ) )
{

0 comments on commit 8ef715b

Please sign in to comment.
You can’t perform that action at this time.