En esta página

QOpcUaAuthenticationInformation Class

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

Cabecera: #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 realizar un login en un servidor. Los mecanismos de autenticación soportados son

  • Anónimo
  • Nombre de usuario
  • Certificado

El método anónimo se utiliza por defecto, pero también puede configurarse manualmente.

Este es un ejemplo de autenticación utilizando 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 las funciones miembro

QOpcUaAuthenticationInformation::QOpcUaAuthenticationInformation()

Por defecto construye una información de autenticación sin parámetros.

QOpcUaAuthenticationInformation::QOpcUaAuthenticationInformation(const QOpcUaAuthenticationInformation &rhs)

Construye una información de autenticación a partir de rhs.

const QVariant &QOpcUaAuthenticationInformation::authenticationData() const

El contenido de 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 puede invocarse 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 puede invocarse 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 para utilizar certificados.

Cuando se utiliza este tipo de autenticación, debe configurarse correctamente QOpcUaPkiConfiguration en QOpcUaClient.

Nota: Esta función puede ser invocada a través del sistema de meta-objetos 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 en autenticación de certificado con un certificado diferente del certificado del cliente.

Nota: Esta función puede invocarse 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 datos username y password.

Nota: Esta función puede ser invocada a través del sistema de meta-objetos 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.