Sur cette page

QOpcUaAuthenticationInformation Class

Les informations d'authentification OPC UA. En savoir plus...

En-tête : #include <QOpcUaAuthenticationInformation>
CMake : find_package(Qt6 REQUIRED COMPONENTS OpcUa)
target_link_libraries(mytarget PRIVATE Qt6::OpcUa)
qmake : QT += opcua
Depuis : QtOpcUa 5.13

Fonctions publiques

QOpcUaAuthenticationInformation()
QOpcUaAuthenticationInformation(const QOpcUaAuthenticationInformation &rhs)
const QVariant &authenticationData() const
QOpcUaUserTokenPolicy::TokenType authenticationType() const
void setAnonymousAuthentication()
void setCertificateAuthentication()
(since 6.9) void setCertificateAuthentication(const QString &certificatePath, const QString &privateKeyPath)
void setUsernameAuthentication(const QString &username, const QString &password)
QOpcUaAuthenticationInformation &operator=(const QOpcUaAuthenticationInformation &rhs)
bool operator==(const QOpcUaAuthenticationInformation &rhs) const

Description détaillée

Cette classe contient les informations nécessaires pour effectuer une connexion sur un serveur. Les mécanismes d'authentification pris en charge sont les suivants

  • Anonyme
  • Nom d'utilisateur
  • Certificat

La méthode anonyme est utilisée par défaut, mais peut également être définie manuellement.

Voici un exemple d'authentification à l'aide d'un nom d'utilisateur et d'un mot de passe.

QOpcUaAuthenticationInformation authInfo;
authInfo.setUsernameAuthentication("user", "password");

m_client->setAuthenticationInformation(authInfo);
m_client->connectToEndpoint(endpoint);

Voir également setAnonymousAuthentication(), setUsernameAuthentication() et setCertificateAuthentication().

Documentation sur les fonctions membres

QOpcUaAuthenticationInformation::QOpcUaAuthenticationInformation()

La fonction « default » génère des informations d'authentification sans aucun paramètre défini.

QOpcUaAuthenticationInformation::QOpcUaAuthenticationInformation(const QOpcUaAuthenticationInformation &rhs)

Crée des informations d'authentification à partir de rhs.

const QVariant &QOpcUaAuthenticationInformation::authenticationData() const

Le contenu de l'QVariant e renvoyé par cette méthode dépend de la méthode d'authentification actuellement sélectionnée.

[invokable] QOpcUaUserTokenPolicy::TokenType QOpcUaAuthenticationInformation::authenticationType() const

Renvoie le type d'authentification actuel.

Remarque : cette fonction peut être appelée via le système de méta-objets et depuis QML. Voir Q_INVOKABLE.

Voir également QOpcUaUserTokenPolicy::TokenType.

[invokable] void QOpcUaAuthenticationInformation::setAnonymousAuthentication()

Définit la méthode d'authentification sur « anonyme ».

Remarque : cette fonction peut être appelée via le système de méta-objets et depuis QML. Voir Q_INVOKABLE.

[invokable] void QOpcUaAuthenticationInformation::setCertificateAuthentication()

Définit la méthode d'authentification utilisant des certificats.

Lorsque vous utilisez ce type d'authentification, un fichier « QOpcUaPkiConfiguration » correctement configuré doit être défini à l'emplacement QOpcUaClient.

Remarque : cette fonction peut être appelée via le système de méta-objets et depuis QML. Voir Q_INVOKABLE.

Voir également QOpcUaPkiConfiguration et QOpcUaClient::setPkiConfiguration().

[invokable, since 6.9] void QOpcUaAuthenticationInformation::setCertificateAuthentication(const QString &certificatePath, const QString &privateKeyPath)

Définit la méthode d'authentification sur l'authentification par certificat, avec un certificat différent du certificat client.

Remarque : cette fonction peut être appelée via le système de méta-objets et depuis QML. Voir Q_INVOKABLE.

Cette fonction a été introduite dans Qt 6.9.

[invokable] void QOpcUaAuthenticationInformation::setUsernameAuthentication(const QString &username, const QString &password)

Définit la méthode d'authentification sur « username », en utilisant les valeurs fournies pour username et password.

Remarque : cette fonction peut être appelée via le système de méta-objets et depuis QML. Voir Q_INVOKABLE.

QOpcUaAuthenticationInformation &QOpcUaAuthenticationInformation::operator=(const QOpcUaAuthenticationInformation &rhs)

Définit les valeurs provenant de rhs dans ces informations d'authentification.

bool QOpcUaAuthenticationInformation::operator==(const QOpcUaAuthenticationInformation &rhs) const

Renvoie « true » si ces informations d'authentification ont la même valeur que « rhs ».

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.