En esta página

QOpcUaAuthenticationInformation Class

La información de autenticación de OPC UA. Más...

Encabezado: #include <QOpcUaAuthenticationInformation>
CMake: find_package(Qt6 REQUIRED COMPONENTS OpcUa)
target_link_libraries(mytarget PRIVATE Qt6::OpcUa)
qmake: QT += opcua
Desde: QtOpcUa 5.13

Funciones públicas

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

Descripción detallada

Esta clase contiene la información necesaria para iniciar sesión en un servidor. Los mecanismos de autenticación compatibles son

  • Anónimo
  • Nombre de usuario
  • Certificado

El método anónimo se utiliza de forma predeterminada, pero también se puede configurar manualmente.

Este es un ejemplo de autenticación mediante nombre de usuario y contraseña.

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

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

Véase también setAnonymousAuthentication(), setUsernameAuthentication() y setCertificateAuthentication().

Documentación de funciones de miembro

QOpcUaAuthenticationInformation::QOpcUaAuthenticationInformation()

«Default» genera una información de autenticación sin parámetros definidos.

QOpcUaAuthenticationInformation::QOpcUaAuthenticationInformation(const QOpcUaAuthenticationInformation &rhs)

Crea un objeto de información de autenticación a partir de rhs.

const QVariant &QOpcUaAuthenticationInformation::authenticationData() const

El contenido del objeto ` QVariant ` devuelto por este método depende del método de autenticación seleccionado en ese momento.

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

Devuelve el tipo de autenticación actual.

Nota: Esta función se puede invocar a través del sistema de metaobjetos y desde QML. Véase Q_INVOKABLE.

Véase también QOpcUaUserTokenPolicy::TokenType.

[invokable] void QOpcUaAuthenticationInformation::setAnonymousAuthentication()

Establece el método de autenticación como «anónimo».

Nota: Esta función se puede invocar a través del sistema de metaobjetos y desde QML. Véase Q_INVOKABLE.

[invokable] void QOpcUaAuthenticationInformation::setCertificateAuthentication()

Establece el método de autenticación mediante certificados.

Al utilizar este tipo de autenticación, es necesario configurar correctamente el objeto « QOpcUaPkiConfiguration » y asignarlo a « QOpcUaClient ».

Nota: Esta función se puede invocar a través del sistema de metaobjetos y desde QML. Véase ` Q_INVOKABLE`.

Véase también ` QOpcUaPkiConfiguration ` y ` QOpcUaClient::setPkiConfiguration()`.

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

Establece el método de autenticación como «autenticación por certificado» con un certificado distinto del certificado del cliente.

Nota: Esta función se puede invocar a través del sistema de metaobjetos y desde QML. Véase Q_INVOKABLE.

Esta función se introdujo en Qt 6.9.

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

Establece el método de autenticación en «nombre de usuario», utilizando los valores proporcionados en username y password.

Nota: Esta función se puede invocar a través del sistema de metaobjetos y desde QML. Véase Q_INVOKABLE.

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

Establece los valores de rhs en esta información de autenticación.

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

Devuelve « true » si esta información de autenticación tiene el mismo valor 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.