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)를 호출합니다.
참고: 브라우저가 아닌 클라이언트를 통해 서버에 액세스하는 경우 클라이언트가 원하는 오리진 헤더를 설정할 수 있으므로 오리진 확인은 큰 의미가 없습니다. 브라우저 클라이언트의 경우 서버는 오리진의 유효성을 확인해야 합니다.
웹소켓 보안 고려사항 및 QWebSocketServer 을참조하세요 .
멤버 함수 문서
[explicit]
QWebSocketCorsAuthenticator::QWebSocketCorsAuthenticator(const QString &origin)
주어진 origin 을 사용하여 새 QCorsAuthencator 객체를 생성합니다.
참고: 기본적으로 allowed()는 참을 반환합니다. 즉, 기본적으로 모든 원점이 허용됩니다.
[explicit]
QWebSocketCorsAuthenticator::QWebSocketCorsAuthenticator(const QWebSocketCorsAuthenticator &other)
other 의 복사본을 생성합니다.
[noexcept]
QWebSocketCorsAuthenticator::QWebSocketCorsAuthenticator(QWebSocketCorsAuthenticator &&other)
이동 - QWebSocketCorsAuthenticator를 생성하여 other 이 가리키고 있던 객체와 동일한 객체를 가리키도록 합니다.
[noexcept]
QWebSocketCorsAuthenticator::~QWebSocketCorsAuthenticator()
개체를 파괴합니다.
bool QWebSocketCorsAuthenticator::allowed() const
출처가 허용되면 참을 반환하고, 그렇지 않으면 거짓을 반환합니다.
참고: 기본적으로 모든 출처가 허용됩니다.
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 이 인증자 개체에 할당합니다.
© 2025 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.