1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761
|
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/auth/qgsauthconfigurationstorage.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/
class QgsAuthConfigurationStorage: QObject
{
%Docstring(signature="appended")
Abstract class that defines the interface for all authentication
configuration storage implementations.
.. versionadded:: 3.40
%End
%TypeHeaderCode
#include "qgsauthconfigurationstorage.h"
%End
public:
struct MasterPasswordConfig
{
QString salt;
QString civ;
QString hash;
};
struct SettingParameter
{
QString name;
QString description;
QVariant::Type type;
};
QgsAuthConfigurationStorage( const QMap<QString, QVariant> &settings );
%Docstring
Creates a new authentication configuration storage.
:param settings: Implementation-specific configuration settings.
%End
virtual ~QgsAuthConfigurationStorage();
virtual QString name() const = 0;
%Docstring
Returns a human readable localized short name of the storage
implementation (e.g "SQLite"). This name is displayed to the user and
used to identify the storage implementation.
%End
virtual QString type() const = 0;
%Docstring
Returns the type of the storage implementation. The type is used to
identify the storage implementation internally (e.g. "sqlite"). A valid
type must be ASCII alphanumeric and contain no spaces.
%End
virtual QString description() const = 0;
%Docstring
Returns a human readable localized description of the storage
implementation (e.g. "Store credentials in a local SQLite database").
This description is displayed to the user.
%End
virtual QString id() const = 0;
%Docstring
Returns the unique identifier of the storage object. The id is used to
uniquely identify the storage object (e.g. the path or the connection
URI to a storage configuration).
%End
virtual bool initialize();
%Docstring
Initializes the storage.
:return: ``True`` if the storage was successfully initialized, ``False``
otherwise. If the storage is already initialized, this method
does nothing and returns ``True``.
.. note::
The default implementation does nothing and returns ``True``.
This method is called by the authentication manager when the storage is added to the manager.
%End
virtual QString lastError() const;
%Docstring
Returns the last error message.
%End
virtual bool isReady() const = 0;
%Docstring
Returns ``True`` is the storage is ready to be used.
.. note::
This method should be called after the :py:func:`~QgsAuthConfigurationStorage.initialize` method to check whether the initialization was properly completed.
%End
Qgis::AuthConfigurationStorageCapabilities capabilities() const;
%Docstring
Returns the capabilities of the storage.
%End
QMap<QString, QVariant> settings() const;
%Docstring
Returns the settings of the storage.
%End
virtual QList<QgsAuthConfigurationStorage::SettingParameter> settingsParameters() const = 0;
%Docstring
Returns a list of the settings accepted by the storage.
%End
bool isEncrypted() const;
%Docstring
Returns ``True`` if the storage is encrypted.
%End
bool isEnabled() const;
%Docstring
Returns ``True`` if the storage is enabled.
%End
void setEnabled( bool enabled );
%Docstring
Set the storage enabled status to ``enabled``.
.. note::
This is a user-controlled setting: the storage may be enabled but not ready to be used.
%End
virtual void setReadOnly( bool readOnly );
%Docstring
Utility method to unset all editing capabilities.
.. note::
This method does not alter existing capabilities, make sure subclasses recompute capabilities if needed.
%End
virtual bool isReadOnly() const;
%Docstring
Returns ``True`` if the storage is read-only, ``False`` otherwise.
.. seealso:: :py:func:`setReadOnly`
%End
virtual QgsAuthMethodConfigsMap authMethodConfigs( const QStringList &allowedMethods = QStringList() ) const throw( QgsNotSupportedException ) = 0;
%Docstring
Returns a mapping of authentication configurations available from this
storage.
:param allowedMethods: Optional filter to return only configurations for
specific authentication methods.
:raises QgsNotSupportedException: if the operation is not supported by
the storage.
%End
virtual QgsAuthMethodConfigsMap authMethodConfigsWithPayload( ) const throw( QgsNotSupportedException ) = 0;
%Docstring
Returns a mapping of authentication configurations available from this
storage. The encrypted payload is added to the configuration as
"encrypted_payload" key.
:raises QgsNotSupportedException: if the operation is not supported by
the storage
.. note::
This convenience method is used by the authentication manager to retrieve the configurations
and check if it can decrypt all of them, it is faster than retrieve all the configurations one
by one.
%End
virtual QgsAuthMethodConfig loadMethodConfig( const QString &id, QString &payload /Out/, bool full = false ) const throw( QgsNotSupportedException ) = 0;
%Docstring
Load an authentication configuration from the database.
:param id: Configuration id.
:param full: If ``True``, the full configuration is loaded and the
(possibly encrypted) payload is populated, otherwise only
the configuration metadata is loaded.
:return: - Authentication configuration metadata.
- payload: (possibly encrypted) payload.
:raises QgsNotSupportedException: if the operation is not supported by
the storage.
%End
virtual bool storeMethodConfig( const QgsAuthMethodConfig &config, const QString &payload ) throw( QgsNotSupportedException ) = 0;
%Docstring
Store an authentication config in the database.
:param config: Authentication configuration.
:param payload: payload to store (possibly encrypted).
:return: Whether operation succeeded
:raises QgsNotSupportedException: if the operation is not supported by
the storage.
%End
virtual bool removeMethodConfig( const QString &id ) throw( QgsNotSupportedException ) = 0;
%Docstring
Removes the authentication configuration with the specified ``id``.
:return: ``True`` if the configuration was removed, ``False`` otherwise.
:raises QgsNotSupportedException: if the operation is not supported by
the storage.
%End
virtual bool methodConfigExists( const QString &id ) const throw( QgsNotSupportedException ) = 0;
%Docstring
Check if an authentication configuration exists in the storage.
:param id: Configuration id.
:return: ``True`` if the configuration exists, ``False`` otherwise.
:raises QgsNotSupportedException: if the operation is not supported by
the storage.
%End
virtual bool storeAuthSetting( const QString &key, const QString &value ) throw( QgsNotSupportedException ) = 0;
%Docstring
Store an authentication setting in the storage.
:param key: Setting key.
:param value: Setting value.
:return: Whether operation succeeded
:raises QgsNotSupportedException: if the operation is not supported by
the storage.
%End
virtual QString loadAuthSetting( const QString &key ) const throw( QgsNotSupportedException ) = 0;
%Docstring
Load an authentication setting from the storage.
:param key: Setting key.
:return: Setting value.
:raises QgsNotSupportedException: if the operation is not supported by
the storage.
%End
virtual bool removeAuthSetting( const QString &key ) throw( QgsNotSupportedException ) = 0;
%Docstring
Remove an authentication setting from the storage.
:param key: Setting key.
:return: Whether operation succeeded
:raises QgsNotSupportedException: if the operation is not supported by
the storage.
%End
virtual bool authSettingExists( const QString &key ) const throw( QgsNotSupportedException ) = 0;
%Docstring
Check if an authentication setting exists in the storage.
:param key: Setting key.
:return: ``True`` if the setting exists, ``False`` otherwise.
:raises QgsNotSupportedException: if the operation is not supported by
the storage.
%End
virtual bool storeCertIdentity( const QSslCertificate &cert, const QString &keyPem ) throw( QgsNotSupportedException ) = 0;
%Docstring
Store a certificate identity in the storage.
:param cert: Certificate.
:param keyPem: SSL key in PEM format.
:return: Whether operation succeeded
:raises QgsNotSupportedException: if the operation is not supported by
the storage.
%End
virtual bool removeCertIdentity( const QSslCertificate &cert ) throw( QgsNotSupportedException ) = 0;
%Docstring
Remove a certificate identity from the storage.
:param cert: Certificate.
:return: Whether operation succeeded
:raises QgsNotSupportedException: if the operation is not supported by
the storage.
%End
virtual const QSslCertificate loadCertIdentity( const QString &id ) const throw( QgsNotSupportedException ) = 0;
%Docstring
certIdentity get a certificate identity by ``id`` (sha hash)
:param id: sha hash of the cert
:return: the certificate
:raises QgsNotSupportedException: if the operation is not supported by
the storage.
%End
virtual const QPair<QSslCertificate, QString> loadCertIdentityBundle( const QString &id ) const throw( QgsNotSupportedException ) = 0;
%Docstring
Returns a certificate identity bundle by ``id`` (sha hash).
:param id: sha shash
:return: a pair with the certificate and its SSL key as an encrypted
string
:raises QgsNotSupportedException: if the operation is not supported by
the storage.
%End
virtual const QList<QSslCertificate> certIdentities() const throw( QgsNotSupportedException ) = 0;
%Docstring
certIdentities get certificate identities
:return: list of certificates
:raises QgsNotSupportedException: if the operation is not supported by
the storage.
%End
virtual QStringList certIdentityIds() const throw( QgsNotSupportedException ) = 0;
%Docstring
certIdentityIds get list of certificate identity ids from database
:return: list of certificate ids
:raises QgsNotSupportedException: if the operation is not supported by
the storage.
%End
virtual bool certIdentityExists( const QString &id ) const throw( QgsNotSupportedException ) = 0;
%Docstring
Check if the certificate identity exists
:param id: Certificate identity id
:return: ``True`` if the certificate identity exists, ``False``
otherwise
:raises QgsNotSupportedException: if the operation is not supported by
the storage.
%End
virtual bool removeCertIdentity( const QString &id ) throw( QgsNotSupportedException ) = 0;
%Docstring
Remove a certificate identity from the storage.
:param id: Certificate identity id
:return: Whether operation succeeded
:raises QgsNotSupportedException: if the operation is not supported by
the storage.
%End
virtual bool storeSslCertCustomConfig( const QgsAuthConfigSslServer &config ) throw( QgsNotSupportedException ) = 0;
%Docstring
Store an SSL certificate custom config
:param config: SSL certificate custom config
:return: Whether operation succeeded
:raises QgsNotSupportedException: if the operation is not supported by
the storage.
%End
virtual const QgsAuthConfigSslServer loadSslCertCustomConfig( const QString &id, const QString &hostport ) const throw( QgsNotSupportedException ) = 0;
%Docstring
Loads 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
:raises QgsNotSupportedException: if the operation is not supported by
the storage.
%End
virtual const QgsAuthConfigSslServer loadSslCertCustomConfigByHost( const QString &hostport ) const throw( QgsNotSupportedException ) = 0;
%Docstring
Loads an SSL certificate custom config by ``hostport`` (host:port)
:param hostport: host:port
:return: a SSL certificate custom config
:raises QgsNotSupportedException: if the operation is not supported by
the storage.
%End
virtual const QList<QgsAuthConfigSslServer> sslCertCustomConfigs() const throw( QgsNotSupportedException ) = 0;
%Docstring
sslCertCustomConfigs get SSL certificate custom configs
:return: list of SSL certificate custom config
:raises QgsNotSupportedException: if the operation is not supported by
the storage.
%End
virtual QStringList sslCertCustomConfigIds() const throw( QgsNotSupportedException ) = 0;
%Docstring
Returns the list of SSL certificate custom config ids.
:return: list of SSL certificate custom config ids
:raises QgsNotSupportedException: if the operation is not supported by
the storage.
%End
virtual bool sslCertCustomConfigExists( const QString &id, const QString &hostport ) throw( QgsNotSupportedException ) = 0;
%Docstring
Check if SSL certificate custom config exists
:param id: sha hash
:param hostport: host:port
:return: ``True`` if the SSL certificate custom config exists, ``False``
otherwise
:raises QgsNotSupportedException: if the operation is not supported by
the storage.
%End
virtual bool removeSslCertCustomConfig( const QString &id, const QString &hostport ) throw( QgsNotSupportedException ) = 0;
%Docstring
Remove an SSL certificate custom config
:param id: sha hash
:param hostport: host:port
:return: Whether operation succeeded
:raises QgsNotSupportedException: if the operation is not supported by
the storage.
%End
virtual bool storeCertAuthority( const QSslCertificate &cert ) throw( QgsNotSupportedException ) = 0;
%Docstring
Store a certificate authority
:param cert: Certificate authority
:return: Whether operation succeeded
:raises QgsNotSupportedException: if the operation is not supported by
the storage.
%End
virtual QStringList certAuthorityIds() const throw( QgsNotSupportedException ) = 0;
%Docstring
Returns the list of certificate authority IDs in the storage.
:return: list of certificate authority IDs
:raises QgsNotSupportedException: if the operation is not supported by
the storage.
%End
virtual const QSslCertificate loadCertAuthority( const QString &id ) const throw( QgsNotSupportedException ) = 0;
%Docstring
certAuthority get a certificate authority by ``id`` (sha hash)
:param id: sha hash
:return: a (possibly empty) certificate
:raises QgsNotSupportedException: if the operation is not supported by
the storage.
%End
virtual bool certAuthorityExists( const QSslCertificate &cert ) const throw( QgsNotSupportedException ) = 0;
%Docstring
Check if a certificate authority exists
:param cert: Certificate authority
:return: ``True`` if the certificate authority exists, ``False``
otherwise
:raises QgsNotSupportedException: if the operation is not supported by
the storage.
%End
virtual bool removeCertAuthority( const QSslCertificate &cert ) throw( QgsNotSupportedException ) = 0;
%Docstring
Remove a certificate authority
:param cert: Certificate authority
:return: Whether operation succeeded
:raises QgsNotSupportedException: if the operation is not supported by
the storage.
%End
virtual const QMap<QString, QgsAuthCertUtils::CertTrustPolicy> caCertsPolicy() const throw( QgsNotSupportedException ) = 0;
%Docstring
Returns the map of CA certificates hashes in the storages and their
trust policy.
:return: map of CA certificates hashes and their trust policy
:raises QgsNotSupportedException: if the operation is not supported by
the storage.
%End
virtual const QList<QSslCertificate> caCerts() const throw( QgsNotSupportedException ) = 0;
%Docstring
Returns the list of CA certificates in the storage
:return: list of CA certificates
:raises QgsNotSupportedException: if the operation is not supported by
the storage.
%End
virtual bool storeCertTrustPolicy( const QSslCertificate &cert, QgsAuthCertUtils::CertTrustPolicy policy ) throw( QgsNotSupportedException ) = 0;
%Docstring
Store certificate trust policy
:param cert: Certificate
:param policy: Trust policy
:return: Whether operation succeeded
:raises QgsNotSupportedException: if the operation is not supported by
the storage.
%End
virtual QgsAuthCertUtils::CertTrustPolicy loadCertTrustPolicy( const QSslCertificate &cert ) const throw( QgsNotSupportedException ) = 0;
%Docstring
Load certificate trust policy
:param cert: Certificate
:return: Trust policy
:raises QgsNotSupportedException: if the operation is not supported by
the storage.
%End
virtual bool removeCertTrustPolicy( const QSslCertificate &cert ) throw( QgsNotSupportedException ) = 0;
%Docstring
Remove certificate trust policy
:param cert: Certificate
:return: Whether operation succeeded
:raises QgsNotSupportedException: if the operation is not supported by
the storage.
%End
virtual bool certTrustPolicyExists( const QSslCertificate &cert ) const throw( QgsNotSupportedException ) = 0;
%Docstring
Check if certificate trust policy exists
:param cert: Certificate
:return: ``True`` if the certificate trust policy exists, ``False``
otherwise
:raises QgsNotSupportedException: if the operation is not supported by
the storage.
%End
virtual const QList<QgsAuthConfigurationStorage::MasterPasswordConfig> masterPasswords( ) const throw( QgsNotSupportedException ) = 0;
%Docstring
Returns the list of (encrypted) master passwords stored in the database.
:return: list of master passwords
:raises QgsNotSupportedException: if the operation is not supported by
the storage.
%End
virtual bool storeMasterPassword( const QgsAuthConfigurationStorage::MasterPasswordConfig &config ) throw( QgsNotSupportedException ) = 0;
%Docstring
Store a master password in the database.
:param config: Master password configuration.
:return: ``True`` if operation succeeded
:raises QgsNotSupportedException: if the operation is not supported by
the storage.
%End
virtual bool clearMasterPasswords() throw( QgsNotSupportedException ) = 0;
%Docstring
Remove all master passwords from the database.
:return: ``True`` if operation succeeded
:raises QgsNotSupportedException: if the operation is not supported by
the storage.
%End
virtual bool erase() throw( QgsNotSupportedException ) = 0;
%Docstring
Completely erase the storage removing all configurations/certs/settings
etc.
:return: ``True`` if storage was completely erased, ``False`` if any
error occurred.
:raises QgsNotSupportedException: if the operation is not supported by
the storage (e.g. the storage is
read-only).
%End
virtual bool clearMethodConfigs() throw( QgsNotSupportedException ) = 0;
%Docstring
Remove all authentications configurations from the storage.
:return: ``True`` if authentications configurations were removed,
``False`` otherwise.
.. note::
This method does not remove certificate and other assets.
:raises QgsNotSupportedException: if the operation is not supported by
the storage.
%End
signals:
void messageLog( const QString &message, const QString &tag = QStringLiteral( "Authentication" ), Qgis::MessageLevel level = Qgis::MessageLevel::Info );
%Docstring
Custom logging signal to relay to console output and
:py:class:`QgsMessageLog`
:param message: Message to send
:param tag: Associated tag (title)
:param level: Message log level
.. seealso:: :py:class:`QgsMessageLog`
%End
void storageChanged( const QString &id );
%Docstring
Emitted when the storage was updated.
:param id: The storage id
.. note::
This is a generic changed signal and it is normally
emitted together with the dedicated signals which are
provided for specific changes on the individual tables.
%End
void methodConfigChanged( );
%Docstring
Emitted when the storage method config table was changed.
%End
void masterPasswordChanged();
%Docstring
Emitted when the storage master password table was changed.
%End
void authSettingsChanged();
%Docstring
Emitted when the storage auth settings table was changed.
%End
void readOnlyChanged( bool readOnly );
%Docstring
Emitted when the storage read-only status was changed.
%End
void certIdentityChanged();
%Docstring
Emitted when the storage cert identity table was changed.
%End
void certAuthorityChanged();
%Docstring
Emitted when the storage cert authority table was changed.
%End
void sslCertCustomConfigChanged();
%Docstring
Emitted when the storage ssl cert custom config table was changed.
%End
void sslCertTrustPolicyChanged();
%Docstring
Emitted when the storage ssl cert trust policy table was changed.
%End
protected:
void setCapabilities( Qgis::AuthConfigurationStorageCapabilities capabilities );
%Docstring
Set the capabilities of the storage to ``capabilities``.
%End
void setError( const QString &error, Qgis::MessageLevel level = Qgis::MessageLevel::Critical );
%Docstring
Set the last error message to ``error`` with message level ``level``.
%End
virtual QString loggerTag() const;
%Docstring
Returns the logger tag for the storage. The default implementation
returns the literal "Auth storage" followed by the storage name.
%End
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/auth/qgsauthconfigurationstorage.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/
|