Sur cette page

QOpcUaAuthenticationInformation Class

Les informations d'authentification OPC UA. Plus d'informations...

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 par nom d'utilisateur et mot de passe.

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

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

Voir aussi setAnonymousAuthentication(), setUsernameAuthentication(), et setCertificateAuthentication().

Documentation des fonctions membres

QOpcUaAuthenticationInformation::QOpcUaAuthenticationInformation()

Par défaut, une information d'authentification est construite sans aucun paramètre défini.

QOpcUaAuthenticationInformation::QOpcUaAuthenticationInformation(const QOpcUaAuthenticationInformation &rhs)

Construit une information d'authentification à partir de rhs.

const QVariant &QOpcUaAuthenticationInformation::authenticationData() const

Le contenu de l'adresse QVariant renvoyée 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.

Note : Cette fonction peut être invoquée via le système de méta-objets et à partir de QML. Voir Q_INVOKABLE.

Voir également QOpcUaUserTokenPolicy::TokenType.

[invokable] void QOpcUaAuthenticationInformation::setAnonymousAuthentication()

Définit la méthode d'authentification comme étant anonyme.

Note : Cette fonction peut être invoquée via le système de méta-objets et à partir de QML. Voir Q_INVOKABLE.

[invokable] void QOpcUaAuthenticationInformation::setCertificateAuthentication()

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

Lors de l'utilisation de ce type d'authentification, une configuration appropriée de QOpcUaPkiConfiguration doit être définie sur QOpcUaClient.

Note : Cette fonction peut être invoquée via le système de méta-objets et à partir de 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 en tant qu'authentification par certificat avec un certificat différent de celui du client.

Note : Cette fonction peut être invoquée via le système de méta-objets et à partir de 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 pour le nom d'utilisateur, en utilisant les données username et password.

Note : Cette fonction peut être invoquée via le système de méta-objets et à partir de QML. Voir Q_INVOKABLE.

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

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

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

Renvoie true si cette information d'authentification a 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.