QWebSocketCorsAuthenticator¶
The
QWebSocketCorsAuthenticator
class provides an authenticator object for Cross Origin Requests (CORS). More…
Synopsis¶
Functions¶
def
allowed
()def
origin
()def
setAllowed
(allowed)def
swap
(other)
Detailed Description¶
The
QWebSocketCorsAuthenticator
class is used in theoriginAuthenticationRequired()
signal. The class provides a way to pass back the required information to theQWebSocketServer
. It provides applications with fine-grained control over which origin URLs are allowed and which aren’t. By default, every origin is accepted. To get fine-grained control, an application connects theoriginAuthenticationRequired()
signal to a slot. When the origin (origin()
) is accepted, it callssetAllowed
(true)Note
Checking on the origin does not make much sense when the server is accessed via a non-browser client, as that client can set whatever origin header it likes. In case of a browser client, the server SHOULD check the validity of the origin.
See also
WebSocket Security Considerations
QWebSocketServer
- class PySide2.QtWebSockets.QWebSocketCorsAuthenticator(origin)¶
PySide2.QtWebSockets.QWebSocketCorsAuthenticator(other)
- Parameters:
origin – str
- PySide2.QtWebSockets.QWebSocketCorsAuthenticator.allowed()¶
- Return type:
bool
Returns true if the origin is allowed, otherwise returns false.
Note
By default, all origins are accepted.
See also
- PySide2.QtWebSockets.QWebSocketCorsAuthenticator.origin()¶
- Return type:
str
Returns the origin this autenticator is handling about.
- PySide2.QtWebSockets.QWebSocketCorsAuthenticator.setAllowed(allowed)¶
- Parameters:
allowed – bool
Allows or disallows the origin. Setting
allowed
to true, will accept the connection request for the given origin.Setting
allowed
to false, will reject the connection request.Note
By default, all origins are accepted.
See also
- PySide2.QtWebSockets.QWebSocketCorsAuthenticator.swap(other)¶
- Parameters:
Swaps
other
with this authenticator.This operation is very fast and never fails.
© 2022 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.