A singleton instance to manage authentication. More...
This class was introduced in Esri::ArcGISRuntime 100.0.
- clientCertificateInfos : const QStringList
|void||clientCertificatePasswordRequired(const QUrl &certificate)|
Static Public Members
|bool||addClientCertificate(const QUrl &clientCertificate, const QString &password = QString())|
|void||fetchLoginTypeForUrl(const QUrl &url)|
This class allows you to manage authentication/security related tasks.
It emits the authenticationChallenge signal whenever an authentication or security issue is encountered anywhere in the API.
The following challenges can be raised by the AuthenticationManager:
- AuthenticationChallengeType::UsernamePassword - Challenges needing username and/or password authentication.
- AuthenticationChallengeType::OAuth - Challenges needing an OAuth authorization code.
- AuthenticationChallengeType::ClientCertificate - Challenges needing a client certificate to be provided.
- AuthenticationChallengeType::SslHandshake - Challenges needing a response to certain SslError errors, usually an untrusted host due to a self-signed certificate.
To handle authentication challenges in the UI automatically in QML, import the Esri.ArcGISRuntime.Dialogs module and declare the AuthenticationView component. After registering the AuthenticationManager type with QML, populate the authenticationManager property of the view with the AuthenticationManager::instance() exposed from C++ to QML. You can register the AuthenticationManager as a QML type with the following syntax:
qmlRegisterUncreatableType<AuthenticationManager>("Esri.TestNamespace", 1, 0, "AuthenticationManager", "AuthenticationManager is uncreateable");
To see a full example of using the AuthenticationView with the AuthenticationManager, please see the token authentication sample.
It also contains an instance of a CredentialCache which maintains a cache of credentials, in memory, that have been previously used to satisfy authentication challenges. This allows a credential to be reused where appropriate, and prevents unnecessary or duplicate challenges from being issued while accessing secure resources from the same security realm. Caching happens automatically if isCredentialCacheEnabled() is true.
Note: When the user wants to sign out, the CredentialCache::removeAllCredentials() method must be called explicitly to clear the credential cache.
clientCertificateInfos : const QStringList
This property holds the list of client certfication information available from the authentication manager to be used for a client certification authentication challenge (read-only).
Use the index of this list to respond to a client certificate authentication challenge with AuthenticationChallenge::continueWithClientCertificate
Member Function Documentation
[signal] void AuthenticationManager::authenticationChallenge(Esri::ArcGISRuntime::AuthenticationChallenge *challenge)
AuthenticationManager emits this signal when a response from an authentication challenge is required.
Since Esri::ArcGISRuntime 100.1, authentication challenges occur sequentially. The application or user must respond to a challenge request to allow following challenges in the queue to be emitted.
See also Returned QObjects Parenting.
Note: Notifier signal for property clientCertificateInfos.
[signal] void AuthenticationManager::clientCertificatePasswordRequired(const QUrl &certificate)
[signal] void AuthenticationManager::fetchLoginTypeForUrlCompleted(Esri::ArcGISRuntime::LoginType loginType)
- loginType The portal login type.
[static] bool AuthenticationManager::addClientCertificate(const QUrl &clientCertificate, const QString &password = QString())
Adds a client certifcate to the authentication manager by providing a path to a clientCertificate file and and optional password for the certificate.
This function returns
true if the certificate was successfully added, or returns
false if the certificate file could not be opened or if the password was incorrect.
This function is invokable from QML.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
[static] Esri::ArcGISRuntime::CredentialCache *AuthenticationManager::credentialCache()
Returns the credential cache being maintained by the authentication manager.
The credential cache contains credentials that have been used previously to satisfy authentication challenges. This allows a credential to be reused where appropriate, and prevents unnecessary or duplicate challenges from being issued while accessing secure resources from the same security realm.
[static] void AuthenticationManager::fetchLoginTypeForUrl(const QUrl &url)
Checks the login type for the given portal url.
LoginType for a given url, and emits the
fetchLoginTypeForUrlCompleted signal when finished. The
loginType that is passed through the signal as a parameter will return as
Unknown if an error occurred or if the URL is invalid.
This function was introduced in Esri::ArcGISRuntime 100.2.
[static] Esri::ArcGISRuntime::AuthenticationManager *AuthenticationManager::instance()
Returns the singleton instance of the AuthenticationManager.
Use this method to get a reference to this instance so you can connect its signals to slots.
true if credentials are cached automatically.
By default, automatic caching is enabled.
Sets whether credential caching is automatically enabled.
See also isCredentialCacheEnabled().