AuthenticationChallenge Class

  • AuthenticationChallenge
  • class Esri::ArcGISRuntime::AuthenticationChallenge

    Represents an authentication challenge when accessing secured resources. More...

    Header: #include <AuthenticationChallenge.h>
    Since: Esri::ArcGISRuntime 100.0
    Inherits: Esri::ArcGISRuntime::Object

    This class was introduced in Esri::ArcGISRuntime 100.0.

    Properties

    Public Functions

    virtual ~AuthenticationChallenge() override
    QUrl authenticatingHost() const
    Esri::ArcGISRuntime::AuthenticationChallengeType authenticationChallengeType() const
    QUrl authorizationUrl() const
    void cancel()
    void cancelWithError(const QString &title, const QString &html)
    void continueWithClientCertificate(int clientCertificateIndex)
    void continueWithCredential(Esri::ArcGISRuntime::Credential *credential)
    void continueWithOAuthAuthorizationCode(const QString &oAuthAuthorizationCode)
    void continueWithSslHandshake(bool trust, bool remember)
    void continueWithUsernamePassword(const QString &username, const QString &password)
    Esri::ArcGISRuntime::Error error() const
    int failureCount() const
    Esri::ArcGISRuntime::Credential *proposedCredential() const
    QUrl requestUrl() const
    QList<QSslError> sslErrors() const

    Detailed Description

    Instances of this class represent an authentication challenge that was raised because a security error was encountered while trying to access a secured network resource. You can connect to the AuthenticationManager::authenticationChallenge signal to handle challenges raised from security errors.

    To satisfy the challenge, you need to do one of the following:

    Property Documentation

    authenticatingHost : const QUrl

    This property holds the host server of the network resource being accessed (read-only).

    This is useful to display to a user when prompting them for a credential when a resource fails to load.

    Access functions:

    QUrl authenticatingHost() const

    authenticationChallengeType : const Esri::ArcGISRuntime::AuthenticationChallengeType

    This property holds the type of authentication challenge (read-only).

    This is useful for displaying a user interface for a credential request when a resource fails to load.

    Access functions:

    Esri::ArcGISRuntime::AuthenticationChallengeType authenticationChallengeType() const

    authorizationUrl : const QUrl

    This property holds the OAuth authorization URL to access to obtain an authorization code (read-only).

    This value is only populated when the challenge type is AuthenticationChallengeType::OAuth for OAuth user authentication.

    Access functions:

    QUrl authorizationUrl() const

    failureCount : const int

    This property holds the number of times this particular challenge has failed (read-only).

    Access functions:

    int failureCount() const

    requestUrl : const QUrl

    This property holds the URL being accessed that led to this authentication challenge (read-only).

    Access functions:

    QUrl requestUrl() const

    Member Function Documentation

    [override virtual] AuthenticationChallenge::~AuthenticationChallenge()

    Destructor.

    void AuthenticationChallenge::cancel()

    Cancels the operation that led to the authentication challenge.

    The resource will fail to load and should emit an error signal.

    This function is invokable from QML.

    Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

    void AuthenticationChallenge::cancelWithError(const QString &title, const QString &html)

    Cancels the operation that led to the authentication challenge.

    This function can be called when the authentication uses an access delegation, based on WebView, like OAuth or SAML. The argument of the function are the title and the html content of the WebView. These arguments are parsed to determine the authentication error.

    The resource will fail to load and should emit an error signal.

    This function is invokable from QML.

    Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

    void AuthenticationChallenge::continueWithClientCertificate(int clientCertificateIndex)

    Attempts to continue with the network transaction with the provided clientCertificateIndex.

    This will obtain a client certificate from AuthenticationManager::clientCertificateInfos which is then applied to the proposed credential to continue with the request.

    This function is invokable from QML.

    Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

    void AuthenticationChallenge::continueWithCredential(Esri::ArcGISRuntime::Credential *credential)

    Attempts to continue with the network transaction with the provided credential.

    Continuing with a null credential will cause the resource to fail to load.

    void AuthenticationChallenge::continueWithOAuthAuthorizationCode(const QString &oAuthAuthorizationCode)

    Attempts to continue with the network transaction with the provided oAuthAuthorizationCode.

    This will populate the proposed credential with the OAuth authorization code to continue with the request.

    This function is invokable from QML.

    Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

    void AuthenticationChallenge::continueWithSslHandshake(bool trust, bool remember)

    Attempts to continue with the network transaction specifying whether to trust the host and remember that decision for future requests.

    If requested to remember to trust or not trust, a specific host, a challenge will not be issued for this host again for the app session.

    This function is invokable from QML.

    Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

    void AuthenticationChallenge::continueWithUsernamePassword(const QString &username, const QString &password)

    Attempts to continue with the network transaction with the provided username and password.

    This will populate the proposed credential with username and password to continue with the request.

    This function is invokable from QML.

    Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

    Esri::ArcGISRuntime::Error AuthenticationChallenge::error() const

    Returns the underlying security error that led to this authentication challenge.

    Esri::ArcGISRuntime::Credential *AuthenticationChallenge::proposedCredential() const

    Returns the credential that is currently being used to access a secured resource.

    This could be a pre-configured credential with limited properties already defined for you. This credential can be used to specify the identity through a username/password, or token, and then call continueWithCredential.

    QList<QSslError> AuthenticationChallenge::sslErrors() const

    Returns a list of QSslError when an SslHandshake error has occurred.

    This value is only populated when the challenge type is AuthenticationChallengeType::SslHandshake indicating that an SSL error occurred when attempting to access a secured resource.

    Inspect these errors or prompt the end user to determine if the request should continue and ignore these errors.

    Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.