PySide6.QtWebSockets.QWebSocketCorsAuthenticator¶
- class QWebSocketCorsAuthenticator¶
- The - QWebSocketCorsAuthenticatorclass provides an authenticator object for Cross Origin Requests (CORS). More…- Synopsis¶- Methods¶- def - __init__()
- def - allowed()
- def - origin()
- def - setAllowed()
- def - swap()
 - Note - This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE - Detailed Description¶- The - QWebSocketCorsAuthenticatorclass is used in the- originAuthenticationRequired()signal. The class provides a way to pass back the required information to the- QWebSocketServer. 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 the- originAuthenticationRequired()signal to a slot. When the origin (- origin()) is accepted, it calls- setAllowed(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. - __init__(origin)¶
- Parameters:
- origin – str 
 
 - Constructs a new QCorsAuthencator object with the given - origin.- Note - By default, - allowed()returns true. This means that per default every origin is accepted.- __init__(other)
- Parameters:
- other – - QWebSocketCorsAuthenticator
 
 - Constructs a copy of - other.- allowed()¶
- Return type:
- bool 
 
 - Returns true if the origin is allowed, otherwise returns false. - origin()¶
- Return type:
- str 
 
 - Returns the origin this autenticator is handling about. - setAllowed(allowed)¶
- Parameters:
- allowed – bool 
 
 - Allows or disallows the origin. Setting - allowedto true, will accept the connection request for the given origin.- Setting - allowedto false, will reject the connection request.- swap(other)¶
- Parameters:
- other – - QWebSocketCorsAuthenticator
 
 - Swaps - otherwith this authenticator.- This operation is very fast and never fails.