Skip to content

Commit 8ef715b

Browse files
authored
Merge pull request #5480 from boundlessgeo/auth_get_removal
[api][auth] Removed get prefix from all getters in auth manager
2 parents 2fdf30c + d64529f commit 8ef715b

19 files changed

+344
-167
lines changed

doc/api_break.dox

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,30 @@ QgsAuthManager {#qgis_api_break_3_0_QgsAuthManager}
539539
- scheduledAuthDbErase() was renamed to scheduledAuthDatabaseErase()
540540
- setScheduledAuthDbErase() was renamed to setScheduledAuthDatabaseErase()
541541
- setScheduledAuthDbEraseRequestEmitted() was renamed to setScheduledAuthDatabaseEraseRequestEmitted()
542+
- getAuthSetting() was renamed to authSetting()
543+
- getCertIdentity() was renamed to certIdentity()
544+
- getCertIdentityBundle() was renamed to certIdentityBundle()
545+
- getCertIdentityBundleToPem() was renamed to certIdentityBundleToPem()
546+
- getCertIdentities() was renamed to certIdentities()
547+
- getCertIdentityIds() was renamed to certIdentityIds()
548+
- getSslCertCustomConfig() was renamed to sslCertCustomConfig()
549+
- getSslCertCustomConfigByHost() was renamed to sslCertCustomConfigByHost()
550+
- getSslCertCustomConfigs() was renamed to sslCertCustomConfigs()
551+
- getIgnoredSslErrorCache() was renamed to ignoredSslErrorCache()
552+
- getCertAuthority() was renamed to certAuthority()
553+
- getSystemRootCAs() was renamed to systemRootCAs()
554+
- getExtraFileCAs() was renamed to extraFileCAs()
555+
- getDatabaseCAs() was renamed to databaseCAs()
556+
- getMappedDatabaseCAs() was renamed to mappedDatabaseCAs()
557+
- getCaCertsCache() was renamed to caCertsCache()
558+
- getCertTrustPolicy() was renamed to certTrustPolicy()
559+
- getCertificateTrustPolicy() was renamed to certificateTrustPolicy()
560+
- getCertTrustCache() was renamed to certTrustCache()
561+
- getTrustedCaCerts() was renamed to trustedCaCerts()
562+
- getUntrustedCaCerts() was renamed to untrustedCaCerts()
563+
- getTrustedCaCertsCache() was renamed to trustedCaCertsCache()
564+
- getTrustedCaCertsPemText() was renamed to trustedCaCertsPemText()
565+
542566

543567

544568
QgsAuthMethod {#qgis_api_break_3_0_QgsAuthMethod}

python/core/auth/qgsauthmanager.sip

Lines changed: 98 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -374,9 +374,14 @@ Store an authentication setting (stored as string via QVariant( value ).toString
374374
:rtype: bool
375375
%End
376376

377-
QVariant getAuthSetting( const QString &key, const QVariant &defaultValue = QVariant(), bool decrypt = false );
378-
%Docstring
379-
Get an authentication setting (retrieved as string and returned as QVariant( QString ))
377+
QVariant authSetting( const QString &key, const QVariant &defaultValue = QVariant(), bool decrypt = false );
378+
%Docstring
379+
authSetting get an authentication setting (retrieved as string and returned as QVariant( QString ))
380+
\param key setting key
381+
\param defaultValue
382+
\param decrypt if the value needs decrypted
383+
:return: QVariant( QString ) authentication setting
384+
.. versionadded:: 3.0
380385
:rtype: QVariant
381386
%End
382387

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

408-
const QSslCertificate getCertIdentity( const QString &id );
413+
const QSslCertificate certIdentity( const QString &id );
409414
%Docstring
410-
Get a certificate identity by id (sha hash)
415+
certIdentity get a certificate identity by ``id`` (sha hash)
416+
\param id sha hash of the cert
417+
:return: the certificate
418+
.. versionadded:: 3.0
411419
:rtype: QSslCertificate
412420
%End
413421

414422

415-
const QStringList getCertIdentityBundleToPem( const QString &id );
423+
const QStringList certIdentityBundleToPem( const QString &id );
416424
%Docstring
417-
Get a certificate identity bundle by id (sha hash) returned as PEM text
425+
certIdentityBundleToPem get a certificate identity bundle by ``id`` (sha hash) returned as PEM text
426+
\param id sha hash
427+
:return: a list of strings
428+
.. versionadded:: 3.0
418429
:rtype: list of str
419430
%End
420431

421-
const QList<QSslCertificate> getCertIdentities();
432+
const QList<QSslCertificate> certIdentities();
422433
%Docstring
423-
Get certificate identities
434+
certIdentities get certificate identities
435+
:return: list of certificates
436+
.. versionadded:: 3.0
424437
:rtype: list of QSslCertificate
425438
%End
426439

427-
QStringList getCertIdentityIds() const;
440+
441+
QStringList certIdentityIds() const;
428442
%Docstring
429-
Get list of certificate identity ids from database
443+
certIdentityIds get list of certificate identity ids from database
444+
:return: list of certificate ids
445+
.. versionadded:: 3.0
430446
:rtype: list of str
431447
%End
432448

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

452-
const QgsAuthConfigSslServer getSslCertCustomConfig( const QString &id, const QString &hostport );
468+
const QgsAuthConfigSslServer sslCertCustomConfig( const QString &id, const QString &hostport );
453469
%Docstring
454-
Get an SSL certificate custom config by id (sha hash) and host:port
470+
sslCertCustomConfig get an SSL certificate custom config by ``id`` (sha hash) and ``hostport`` (host:port)
471+
\param id sha hash
472+
\param hostport string host:port
473+
:return: a SSL certificate custom config
474+
.. versionadded:: 3.0
455475
:rtype: QgsAuthConfigSslServer
456476
%End
457477

458-
const QgsAuthConfigSslServer getSslCertCustomConfigByHost( const QString &hostport );
478+
const QgsAuthConfigSslServer sslCertCustomConfigByHost( const QString &hostport );
459479
%Docstring
460-
Get an SSL certificate custom config by host:port
480+
sslCertCustomConfigByHost get an SSL certificate custom config by ``hostport`` (host:port)
481+
\param hostport host:port
482+
:return: a SSL certificate custom config
483+
.. versionadded:: 3.0
461484
:rtype: QgsAuthConfigSslServer
462485
%End
463486

464-
const QList<QgsAuthConfigSslServer> getSslCertCustomConfigs();
487+
const QList<QgsAuthConfigSslServer> sslCertCustomConfigs();
465488
%Docstring
466-
Get SSL certificate custom configs
489+
sslCertCustomConfigs get SSL certificate custom configs
490+
:return: list of SSL certificate custom config
491+
.. versionadded:: 3.0
467492
:rtype: list of QgsAuthConfigSslServer
468493
%End
469494

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

519-
const QSslCertificate getCertAuthority( const QString &id );
544+
545+
const QSslCertificate certAuthority( const QString &id );
520546
%Docstring
521-
Get a certificate authority by id (sha hash)
547+
certAuthority get a certificate authority by ``id`` (sha hash)
548+
\param id sha hash
549+
:return: a certificate
550+
.. versionadded:: 3.0
522551
:rtype: QSslCertificate
523552
%End
524553

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

537-
const QList<QSslCertificate> getSystemRootCAs();
566+
const QList<QSslCertificate> systemRootCAs();
538567
%Docstring
539-
Get root system certificate authorities
568+
systemRootCAs get root system certificate authorities
569+
:return: list of certificate authorities
570+
.. versionadded:: 3.0
540571
:rtype: list of QSslCertificate
541572
%End
542573

543-
const QList<QSslCertificate> getExtraFileCAs();
574+
const QList<QSslCertificate> extraFileCAs();
544575
%Docstring
545-
Get extra file-based certificate authorities
576+
extraFileCAs extra file-based certificate authorities
577+
:return: list of certificate authorities
578+
.. versionadded:: 3.0
546579
:rtype: list of QSslCertificate
547580
%End
548581

549-
const QList<QSslCertificate> getDatabaseCAs();
582+
const QList<QSslCertificate> databaseCAs();
550583
%Docstring
551-
Get database-stored certificate authorities
584+
databaseCAs get database-stored certificate authorities
585+
:return: list of certificate authorities
586+
.. versionadded:: 3.0
552587
:rtype: list of QSslCertificate
553588
%End
554589

555-
const QMap<QString, QSslCertificate> getMappedDatabaseCAs();
590+
const QMap<QString, QSslCertificate> mappedDatabaseCAs();
556591
%Docstring
557-
Get sha1-mapped database-stored certificate authorities
592+
mappedDatabaseCAs get sha1-mapped database-stored certificate authorities
593+
:return: sha1-mapped certificate authorities
594+
.. versionadded:: 3.0
558595
:rtype: QMap<str, QSslCertificate>
559596
%End
560597

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

574-
QgsAuthCertUtils::CertTrustPolicy getCertTrustPolicy( const QSslCertificate &cert );
611+
QgsAuthCertUtils::CertTrustPolicy certTrustPolicy( const QSslCertificate &cert );
575612
%Docstring
576-
Get a whether certificate is trusted by user
577-
:return: DefaultTrust if certificate sha not in trust table, i.e. follows default trust policy
613+
certTrustPolicy get whether certificate ``cert`` is trusted by user
614+
\param cert
615+
:return: DefaultTrust if certificate sha not in trust table, i.e. follows default trust policy
616+
.. versionadded:: 3.0
578617
:rtype: QgsAuthCertUtils.CertTrustPolicy
579618
%End
580619

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

593-
QgsAuthCertUtils::CertTrustPolicy getCertificateTrustPolicy( const QSslCertificate &cert );
632+
QgsAuthCertUtils::CertTrustPolicy certificateTrustPolicy( const QSslCertificate &cert );
594633
%Docstring
595-
Get trust policy for a particular certificate
634+
certificateTrustPolicy get trust policy for a particular certificate ``cert``
635+
\param cert
636+
:return: DefaultTrust if certificate sha not in trust table, i.e. follows default trust policy
637+
.. versionadded:: 3.0
596638
:rtype: QgsAuthCertUtils.CertTrustPolicy
597639
%End
598640

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

611-
const QMap<QgsAuthCertUtils::CertTrustPolicy, QStringList > getCertTrustCache();
653+
const QMap<QgsAuthCertUtils::CertTrustPolicy, QStringList > certTrustCache();
612654
%Docstring
613-
Get cache of certificate sha1s, per trust policy
655+
certTrustCache get cache of certificate sha1s, per trust policy
656+
:return: trust-policy-mapped certificate sha1s
657+
.. versionadded:: 3.0
614658
:rtype: QMap<QgsAuthCertUtils.CertTrustPolicy, list of str >
615659
%End
616660

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

623-
const QList<QSslCertificate> getTrustedCaCerts( bool includeinvalid = false );
667+
const QList<QSslCertificate> trustedCaCerts( bool includeinvalid = false );
624668
%Docstring
625-
Get list of all trusted CA certificates
669+
trustedCaCerts get list of all trusted CA certificates
670+
\param includeinvalid whether invalid certs needs to be returned
671+
:return: list of certificates
672+
.. versionadded:: 3.0
626673
:rtype: list of QSslCertificate
627674
%End
628675

629-
const QList<QSslCertificate> getUntrustedCaCerts( QList<QSslCertificate> trustedCAs = QList<QSslCertificate>() );
676+
const QList<QSslCertificate> untrustedCaCerts( QList<QSslCertificate> trustedCAs = QList<QSslCertificate>() );
630677
%Docstring
631-
Get list of all untrusted CA certificates
678+
untrustedCaCerts get list of untrusted certificate authorities
679+
:return: list of certificates
680+
.. versionadded:: 3.0
632681
:rtype: list of QSslCertificate
633682
%End
634683

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

641-
const QList<QSslCertificate> getTrustedCaCertsCache();
690+
const QList<QSslCertificate> trustedCaCertsCache();
642691
%Docstring
643-
Get cache of trusted certificate authorities, ready for network connections
692+
trustedCaCertsCache cache of trusted certificate authorities, ready for network connections
693+
:return: list of certificates
694+
.. versionadded:: 3.0
644695
:rtype: list of QSslCertificate
645696
%End
646697

647-
const QByteArray getTrustedCaCertsPemText();
698+
const QByteArray trustedCaCertsPemText();
648699
%Docstring
649-
Get concatenated string of all trusted CA certificates
700+
trustedCaCertsPemText get concatenated string of all trusted CA certificates
701+
:return: bye array with all PEM encoded trusted CAs
702+
.. versionadded:: 3.0
650703
:rtype: QByteArray
651704
%End
652705

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

709762

src/app/qgisapp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12659,7 +12659,7 @@ void QgisApp::namSslErrors( QNetworkReply *reply, const QList<QSslError> &errors
1265912659
QString digest( QgsAuthCertUtils::shaHexForCert( reply->sslConfiguration().peerCertificate() ) );
1266012660
QString dgsthostport( QStringLiteral( "%1:%2" ).arg( digest, hostport ) );
1266112661

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

1266412664
if ( errscache.contains( dgsthostport ) )
1266512665
{

src/auth/identcert/qgsauthidentcertedit.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ void QgsAuthIdentCertEdit::populateIdentityComboBox()
7575
{
7676
cmbIdentityCert->addItem( tr( "Select identity..." ), "" );
7777

78-
QList<QSslCertificate> certs( QgsApplication::authManager()->getCertIdentities() );
78+
QList<QSslCertificate> certs( QgsApplication::authManager()->certIdentities() );
7979
if ( !certs.isEmpty() )
8080
{
8181
cmbIdentityCert->setIconSize( QSize( 26, 22 ) );

src/auth/identcert/qgsauthidentcertmethod.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ bool QgsAuthIdentCertMethod::updateDataSourceUriItems( QStringList &connectionIt
144144
// save CAs to temp file
145145
QString caFilePath = QgsAuthCertUtils::pemTextToTempFile(
146146
pkiTempFileBase.arg( QUuid::createUuid().toString() ),
147-
QgsApplication::authManager()->getTrustedCaCertsPemText() );
147+
QgsApplication::authManager()->trustedCaCertsPemText() );
148148
if ( caFilePath.isEmpty() )
149149
{
150150
return false;
@@ -246,7 +246,7 @@ QgsPkiConfigBundle *QgsAuthIdentCertMethod::getPkiConfigBundle( const QString &a
246246
}
247247

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

251251
// init client cert
252252
// Note: if this is not valid, no sense continuing

src/auth/pkipaths/qgsauthpkipathsmethod.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,17 +161,17 @@ bool QgsAuthPkiPathsMethod::updateDataSourceUriItems( QStringList &connectionIte
161161
{
162162
if ( pkibundle->config().config( QStringLiteral( "addrootca" ), QStringLiteral( "false" ) ) == QStringLiteral( "true" ) )
163163
{
164-
cas = QgsAuthCertUtils::casMerge( QgsApplication::authManager()->getTrustedCaCerts(), pkibundle->caChain() );
164+
cas = QgsAuthCertUtils::casMerge( QgsApplication::authManager()->trustedCaCerts(), pkibundle->caChain() );
165165
}
166166
else
167167
{
168-
cas = QgsAuthCertUtils::casMerge( QgsApplication::authManager()->getTrustedCaCerts(),
168+
cas = QgsAuthCertUtils::casMerge( QgsApplication::authManager()->trustedCaCerts(),
169169
QgsAuthCertUtils::casRemoveSelfSigned( pkibundle->caChain() ) );
170170
}
171171
}
172172
else
173173
{
174-
cas = QgsApplication::authManager()->getTrustedCaCerts();
174+
cas = QgsApplication::authManager()->trustedCaCerts();
175175
}
176176

177177
// save CAs to temp file

src/auth/pkipkcs12/qgsauthpkcs12method.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,17 +161,17 @@ bool QgsAuthPkcs12Method::updateDataSourceUriItems( QStringList &connectionItems
161161
{
162162
if ( pkibundle->config().config( QStringLiteral( "addrootca" ), QStringLiteral( "false" ) ) == QStringLiteral( "true" ) )
163163
{
164-
cas = QgsAuthCertUtils::casMerge( QgsApplication::authManager()->getTrustedCaCerts(), pkibundle->caChain() );
164+
cas = QgsAuthCertUtils::casMerge( QgsApplication::authManager()->trustedCaCerts(), pkibundle->caChain() );
165165
}
166166
else
167167
{
168-
cas = QgsAuthCertUtils::casMerge( QgsApplication::authManager()->getTrustedCaCerts(),
168+
cas = QgsAuthCertUtils::casMerge( QgsApplication::authManager()->trustedCaCerts(),
169169
QgsAuthCertUtils::casRemoveSelfSigned( pkibundle->caChain() ) );
170170
}
171171
}
172172
else
173173
{
174-
cas = QgsApplication::authManager()->getTrustedCaCerts();
174+
cas = QgsApplication::authManager()->trustedCaCerts();
175175
}
176176

177177
// save CAs to temp file

src/core/auth/qgsauthcertutils.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -947,9 +947,9 @@ QList<QgsAuthCertUtils::CertUsageType> QgsAuthCertUtils::certificateUsageTypes(
947947

948948
// ask QCA what it thinks about potential usages
949949
QCA::CertificateCollection trustedCAs(
950-
qtCertsToQcaCollection( QgsApplication::authManager()->getTrustedCaCertsCache() ) );
950+
qtCertsToQcaCollection( QgsApplication::authManager()->trustedCaCertsCache() ) );
951951
QCA::CertificateCollection untrustedCAs(
952-
qtCertsToQcaCollection( QgsApplication::authManager()->getUntrustedCaCerts() ) );
952+
qtCertsToQcaCollection( QgsApplication::authManager()->untrustedCaCerts() ) );
953953

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

0 commit comments

Comments
 (0)