In questa pagina

QOpcUaAuthenticationInformation Class

Le informazioni di autenticazione OPC UA. Per saperne di più...

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

Funzioni pubbliche

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

Descrizione dettagliata

Questa classe contiene le informazioni necessarie per effettuare l'accesso a un server. I meccanismi di autenticazione supportati sono

  • Anonimo
  • Nome utente
  • Certificato

Il metodo anonimo viene utilizzato per impostazione predefinita, ma può anche essere impostato manualmente.

Questo è un esempio di autenticazione tramite nome utente e password.

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

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

Vedi anche setAnonymousAuthentication(), setUsernameAuthentication() e setCertificateAuthentication().

Documentazione sulle funzioni membro

QOpcUaAuthenticationInformation::QOpcUaAuthenticationInformation()

Default crea un oggetto contenente le informazioni di autenticazione senza impostare alcun parametro.

QOpcUaAuthenticationInformation::QOpcUaAuthenticationInformation(const QOpcUaAuthenticationInformation &rhs)

Crea le informazioni di autenticazione da rhs.

const QVariant &QOpcUaAuthenticationInformation::authenticationData() const

Il contenuto dell'oggetto ` QVariant ` restituito da questo metodo dipende dal metodo di autenticazione attualmente selezionato.

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

Restituisce il tipo di autenticazione corrente.

Nota: questa funzione può essere richiamata tramite il sistema dei meta-oggetti e da QML. Vedi Q_INVOKABLE.

Vedi anche QOpcUaUserTokenPolicy::TokenType.

[invokable] void QOpcUaAuthenticationInformation::setAnonymousAuthentication()

Imposta il metodo di autenticazione su "anonimo".

Nota: questa funzione può essere richiamata tramite il sistema dei meta-oggetti e da QML. Vedi Q_INVOKABLE.

[invokable] void QOpcUaAuthenticationInformation::setCertificateAuthentication()

Imposta il metodo di autenticazione tramite certificati.

Quando si utilizza questo tipo di autenticazione, è necessario configurare correttamente un oggetto QOpcUaPkiConfiguration e assegnarlo a QOpcUaClient.

Nota: questa funzione può essere richiamata tramite il sistema dei meta-oggetti e da QML. Vedere Q_INVOKABLE.

Vedi anche QOpcUaPkiConfiguration e QOpcUaClient::setPkiConfiguration().

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

Imposta il metodo di autenticazione su "autenticazione tramite certificato" utilizzando un certificato diverso dal certificato client.

Nota: questa funzione può essere richiamata tramite il sistema dei meta-oggetti e da QML. Vedere Q_INVOKABLE.

Questa funzione è stata introdotta in Qt 6.9.

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

Imposta il metodo di autenticazione su "username", utilizzando i valori specificati in username e password.

Nota: questa funzione può essere richiamata tramite il sistema dei meta-oggetti e da QML. Vedi Q_INVOKABLE.

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

Imposta i valori provenienti da rhs in queste informazioni di autenticazione.

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

Restituisce " true " se queste informazioni di autenticazione hanno lo stesso valore di " 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.