Skip to content

NetworkCredential Class

  • NetworkCredential
  • class Esri::ArcGISRuntime::Authentication::NetworkCredential

    A base class for credentials that can be used to authenticate network connections. More...

    Public Functions

    virtual ~NetworkCredential() override
    Esri::ArcGISRuntime::Authentication::NetworkCredentialType networkCredentialType() const

    Static Public Members

    Esri::ArcGISRuntime::Authentication::CertificateCredential *certificate(const QUrl &path, const QString &password, QObject *parent = nullptr)
    Esri::ArcGISRuntime::Authentication::PasswordCredential *password(const QString &username, const QString &password, QObject *parent = nullptr)

    Detailed Description

    Member Function Documentation

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

    Destructor.

    [static] Esri::ArcGISRuntime::Authentication::CertificateCredential *NetworkCredential::certificate(const QUrl &path, const QString &password, QObject *parent = nullptr)

    Returns a network credential that uses a certificate for authentication.

    • path - The path to the certificate on disk.
    • password - The password for the certificate.
    • parent - An optional QObject parent.

    This method creates a CertificateCredential object by importing a PKCS#12 certificate from the specified path. Internally this calls QSslCertificate::importPkcs12 to populate all the details.

    Not all available Qt ssl socket backends will be able to import a PKCS#12 certificate. If the certificate is not imported, this method will return nullptr.

    Apple platforms (for example) will use the securetransport backend by default, and will not be able to import the certificate. On any unsupported platform, you may see a warning message in the console output.

    qt.network.ssl: The backend "securetransport" cannot read PKCS12 format
    qt.network.ssl: Available TLS backend does not support PKCS12

    If this is an important workflow on a platform you want to target, where the default backend will not suffice, you can build and/or configure Qt to use the openssl backend which will enable this functionality. Refer to Qt's documentation for more information on how to do that.

    See also QSslCertificate::importPkcs12 and CertificateCredential.

    Esri::ArcGISRuntime::Authentication::NetworkCredentialType NetworkCredential::networkCredentialType() const

    Returns the type of the credential.

    [static] Esri::ArcGISRuntime::Authentication::PasswordCredential *NetworkCredential::password(const QString &username, const QString &password, QObject *parent = nullptr)

    Returns a network credential that uses a username and password for authentication.

    • username - The username.
    • password - The password.
    • parent - An optional QObject parent.

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