Skip to content

ArcGISCredentialStore Class

  • ArcGISCredentialStore
  • class Esri::ArcGISRuntime::Authentication::ArcGISCredentialStore

    A store for instances of the subclasses of ArcGISCredential. More...

    Header: #include <Authentication/ArcGISCredentialStore.h>
    Since: Esri::ArcGISRuntime 200.8
    Inherits: Esri::ArcGISRuntime::Object

    Public Functions

    ArcGISCredentialStore(QObject *parent = nullptr)
    virtual ~ArcGISCredentialStore() override
    void add(Esri::ArcGISRuntime::Authentication::ArcGISCredential *arcGISCredential)
    void add(Esri::ArcGISRuntime::Authentication::ArcGISCredential *arcGISCredential, const QUrl &url)
    Esri::ArcGISRuntime::Authentication::ArcGISCredential *credential(const QUrl &url) const
    QList<Esri::ArcGISRuntime::Authentication::ArcGISCredential *> credentials() const
    bool remove(Esri::ArcGISRuntime::Authentication::ArcGISCredential *arcGISCredential)
    void removeAll()
    QList<Esri::ArcGISRuntime::Authentication::ArcGISCredential *> removeCredentials(const QUrl &url)

    Detailed Description

    The credential provided while handling an authentication challenge is placed in the ArcGIS credential store of the ArcGISRuntimeEnvironment::arcGISAuthenticationManager and used by all subsequent requests that have a matching server context.

    See also OAuthUserCredential, OAuthApplicationCredential, PregeneratedTokenCredential, TokenCredential, and ArcGISAuthenticationChallengeHandler.

    Member Function Documentation

    [explicit] ArcGISCredentialStore::ArcGISCredentialStore(QObject *parent = nullptr)

    Creates an instance of an ArcGISCredentialStore.

    • parent - The optional parent QObject.

    [override virtual noexcept] ArcGISCredentialStore::~ArcGISCredentialStore()

    Destructor.

    void ArcGISCredentialStore::add(Esri::ArcGISRuntime::Authentication::ArcGISCredential *arcGISCredential)

    Adds the specified credential to the ArcGISCredentialStore. The credential's server context is used to determine what services the credential can be shared with.

    If a credential for the same server context is already in the store, then it will be replaced.

    See also ArcGISCredential::serverContext and add(Esri::ArcGISRuntime::Authentication::ArcGISCredential*, const QUrl&).

    void ArcGISCredentialStore::add(Esri::ArcGISRuntime::Authentication::ArcGISCredential *arcGISCredential, const QUrl &url)

    Adds a specified credential to the store for a given URL. The URL must be shareable with the server context of the credential. Otherwise, this method throws an ErrorType::AuthenticationCredentialCannotBeShared. When the credential is added to the store with this function, for the credential to be shared with a secured service endpoint, the service endpoint must begin with the specified URL passed to this function call. For example, if you were to specify a store URL of https://www.server.net/arcgis/rest/services/service1/ when calling this function, then the specified credential would be shared with an endpoint such as https://www.server.net/arcgis/rest/services/service1/query, but not for https://www.server.net/arcgis/rest/services/service2/query.

    • arcGISCredential - The credential to be stored within ArcGISCredentialStore.
    • url - The URL to associate the credential with.

    If a credential was already stored for the same URL then it will be replaced.

    See also add(ArcGISCredential*).

    Esri::ArcGISRuntime::Authentication::ArcGISCredential *ArcGISCredentialStore::credential(const QUrl &url) const

    Returns the best matched credential in the ArcGISCredentialStore for the given URL.

    Returns nullptr if there is no matched credential found for the provided URL.

    • url - The URL of an ArcGIS secured resource.

    QList<Esri::ArcGISRuntime::Authentication::ArcGISCredential *> ArcGISCredentialStore::credentials() const

    Returns an array of unique credentials contained in the ArcGISCredentialStore.

    During a logout workflow, users should call this method before calling removeAll, filter all instances of OAuthUserCredential and invalidate them by calling OAuthUserCredential::revokeTokenAsync.

    bool ArcGISCredentialStore::remove(Esri::ArcGISRuntime::Authentication::ArcGISCredential *arcGISCredential)

    Removes the credential from ArcGISCredentialStore if present. Returns true if the credential was found and removed from the store, otherwise false.

    void ArcGISCredentialStore::removeAll()

    Removes all credentials from the ArcGISCredentialStore.

    During a logout workflow, before calling this function, users should call credentials, filter all instances of OAuthUserCredential, and invalidate them using OAuthUserCredential::revokeTokenAsync.

    QList<Esri::ArcGISRuntime::Authentication::ArcGISCredential *> ArcGISCredentialStore::removeCredentials(const QUrl &url)

    Removes any credentials from the ArcGISCredentialStore that would be shared with a service endpoint represented by the provided URL. Returns an array of credentials that were removed.

    • url - The URL to search for and remove credentials from the store.

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