QWebSocketCorsAuthenticator Class
QWebSocketCorsAuthenticator 클래스는 크로스 오리진 요청(CORS)을 위한 인증 객체를 제공합니다. 더 보기...
| 헤더: | #include <QWebSocketCorsAuthenticator> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS WebSockets) target_link_libraries(mytarget PRIVATE Qt6::WebSockets) |
| qmake: | QT += websockets |
공개 함수
| 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) |
상세 설명
QWebSocketCorsAuthenticator 클래스는 ` originAuthenticationRequired()` 신호에서 사용됩니다. 이 클래스는 ` QWebSocketServer`에 필요한 정보를 다시 전달하는 방법을 제공합니다. 이를 통해 애플리케이션은 허용되는 원본 URL과 허용되지 않는 원본 URL을 세밀하게 제어할 수 있습니다. 기본적으로 모든 원본이 허용됩니다. 세밀한 제어를 위해 애플리케이션은 originAuthenticationRequired() 신호를 슬롯에 연결합니다. 오리진(QWebSocketCorsAuthenticator::origin())이 허용되면, QWebSocketCorsAuthenticator::setAllowed(true)를 호출합니다.
참고: 비브라우저 클라이언트를 통해 서버에 액세스하는 경우, 해당 클라이언트는 원하는 대로 오리진 헤더를 설정할 수 있으므로 오리진을확인하는 것은 큰 의미가 없습니다. 브라우저 클라이언트의 경우, 서버는 오리진의 유효성을 확인해야 합니다.
‘WebSocket 보안 고려 사항 ’ 및 ‘ QWebSocketServer’도 참조하십시오 .
멤버 함수 문서
[explicit] QWebSocketCorsAuthenticator::QWebSocketCorsAuthenticator(const QString &origin)
지정된 origin 를 사용하여 새로운 QCorsAuthenticator 객체를 생성합니다.
참고: 기본적으로 allowed()는 true를 반환합니다. 즉, 기본적으로 모든 오리진이 허용됩니다.
[explicit] QWebSocketCorsAuthenticator::QWebSocketCorsAuthenticator(const QWebSocketCorsAuthenticator &other)
other 의 복사본을 생성합니다.
[noexcept] QWebSocketCorsAuthenticator::QWebSocketCorsAuthenticator(QWebSocketCorsAuthenticator &&other)
QWebSocketCorsAuthenticator를 이동 생성하여, 이 객체가 other 가 가리키던 것과 동일한 객체를 가리키도록 만듭니다.
[noexcept] QWebSocketCorsAuthenticator::~QWebSocketCorsAuthenticator()
객체를 삭제합니다.
bool QWebSocketCorsAuthenticator::allowed() const
원본이 허용되는 경우 true를 반환하고, 그렇지 않은 경우 false를 반환합니다.
참고: 기본적으로 모든 출처가 허용됩니다.
setAllowed()도 참조하십시오 .
QString QWebSocketCorsAuthenticator::origin() const
이 인증기가 처리하고 있는 원본을 반환합니다.
void QWebSocketCorsAuthenticator::setAllowed(bool allowed)
해당 출처를 허용하거나 거부합니다. ` allowed `를 `true`로 설정하면, 지정된 출처에 대한 연결 요청을 수락합니다.
allowed 를 false로 설정하면 연결 요청을 거부합니다.
참고: 기본적으로 모든 오리진이 허용됩니다.
allowed()도 참조하십시오 .
[noexcept] void QWebSocketCorsAuthenticator::swap(QWebSocketCorsAuthenticator &other)
other 을 이 인증기와 교체합니다.
이 작업은 매우 빠르며 실패하는 일이 없습니다.
[noexcept] QWebSocketCorsAuthenticator &QWebSocketCorsAuthenticator::operator=(QWebSocketCorsAuthenticator &&other)
other 를 이 인스턴스에 할당합니다.
QWebSocketCorsAuthenticator &QWebSocketCorsAuthenticator::operator=(const QWebSocketCorsAuthenticator &other)
이 인증자 객체에 other 를 할당합니다.
© 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.