QWebSocketCorsAuthenticator Class
La classe QWebSocketCorsAuthenticator fornisce un oggetto di autenticazione per le richieste cross-origin (CORS). Per saperne di più...
| Intestazione: | #include <QWebSocketCorsAuthenticator> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS WebSockets) target_link_libraries(mytarget PRIVATE Qt6::WebSockets) |
| qmake: | QT += websockets |
Funzioni pubbliche
| QWebSocketCorsAuthenticator(const QString &origin) | |
| QWebSocketCorsAuthenticator(const QWebSocketCorsAuthenticator &other) | |
| QWebSocketCorsAuthenticator(QWebSocketCorsAuthenticator &&other) | |
| ~QWebSocketCorsAuthenticator() | |
| bool | allowed() const |
| QString | origin() const |
| void | setAllowed(bool allowed) |
| void | swap(QWebSocketCorsAuthenticator &other) |
| QWebSocketCorsAuthenticator & | operator=(QWebSocketCorsAuthenticator &&other) |
| QWebSocketCorsAuthenticator & | operator=(const QWebSocketCorsAuthenticator &other) |
Descrizione dettagliata
La classe QWebSocketCorsAuthenticator viene utilizzata nel segnale originAuthenticationRequired(). La classe fornisce un modo per restituire le informazioni richieste a QWebSocketServer. Offre alle applicazioni un controllo granulare su quali URL di origine sono consentiti e quali no. Per impostazione predefinita, tutte le origini sono accettate. Per ottenere un controllo dettagliato, un'applicazione collega il segnale originAuthenticationRequired() a uno slot. Quando l'origine (QWebSocketCorsAuthenticator::origin()) viene accettata, chiama QWebSocketCorsAuthenticator::setAllowed(true)
Nota: la verifica dell’origine non ha molto senso quando si accede al server tramite un client diverso da un browser, poiché tale client può impostare qualsiasi intestazione di origine desideri. Nel caso di un client browser, il server DOVREBBE verificare la validità dell’origine.
Vedi anche «WebSocket Security Considerations » e « QWebSocketServer ».
Documentazione delle funzioni membro
[explicit] QWebSocketCorsAuthenticator::QWebSocketCorsAuthenticator(const QString &origin)
Crea un nuovo oggetto QCorsAuthenticator con l'origin specificato.
Nota: per impostazione predefinita, allowed() restituisce true. Ciò significa che, per impostazione predefinita, ogni origine viene accettata.
[explicit] QWebSocketCorsAuthenticator::QWebSocketCorsAuthenticator(const QWebSocketCorsAuthenticator &other)
Crea una copia di other.
[noexcept] QWebSocketCorsAuthenticator::QWebSocketCorsAuthenticator(QWebSocketCorsAuthenticator &&other)
Crea un oggetto `QWebSocketCorsAuthenticator` tramite `move`, facendo sì che punti allo stesso oggetto a cui puntava ` other `.
[noexcept] QWebSocketCorsAuthenticator::~QWebSocketCorsAuthenticator()
Elimina l'oggetto.
bool QWebSocketCorsAuthenticator::allowed() const
Restituisce "true" se l'origine è consentita, altrimenti restituisce "false".
Nota: per impostazione predefinita, tutte le origini sono accettate.
Vedi anche setAllowed().
QString QWebSocketCorsAuthenticator::origin() const
Restituisce l'origine a cui si riferisce questo autenticatore.
void QWebSocketCorsAuthenticator::setAllowed(bool allowed)
Consente o nega l'origine. Impostando ` allowed ` su `true`, verrà accettata la richiesta di connessione per l'origine specificata.
Impostando allowed su "false", la richiesta di connessione verrà rifiutata.
Nota: per impostazione predefinita, tutte le origini sono accettate.
Vedi anche allowed().
[noexcept] void QWebSocketCorsAuthenticator::swap(QWebSocketCorsAuthenticator &other)
Sostituisce other con questo autenticatore.
Questa operazione è molto veloce e non fallisce mai.
[noexcept] QWebSocketCorsAuthenticator &QWebSocketCorsAuthenticator::operator=(QWebSocketCorsAuthenticator &&other)
L'operazione "Move" assegna " other " a questa istanza.
QWebSocketCorsAuthenticator &QWebSocketCorsAuthenticator::operator=(const QWebSocketCorsAuthenticator &other)
Assegna other a questo oggetto autenticatore.
© 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.