QAuthenticator Class

QAuthenticator 클래스는 인증 객체를 제공합니다. 더 보기...

헤더: #include <QAuthenticator>
CMake: find_package(Qt6 REQUIRED COMPONENTS Network)
target_link_libraries(mytarget PRIVATE Qt6::Network)
qmake: QT += network

참고: 이 클래스의 모든 함수는 재진입합니다.

공용 함수

QAuthenticator()
QAuthenticator(const QAuthenticator &other)
~QAuthenticator()
bool isNull() const
QVariant option(const QString &opt) const
QVariantHash options() const
QString password() const
QString realm() const
void setOption(const QString &opt, const QVariant &value)
void setPassword(const QString &password)
void setUser(const QString &user)
QString user() const
bool operator!=(const QAuthenticator &other) const
QAuthenticator &operator=(const QAuthenticator &other)
bool operator==(const QAuthenticator &other) const

상세 설명

QAuthenticator 클래스는 일반적으로 QNetworkAccessManagerQAbstractSocketauthenticationRequired() 및 proxyAuthenticationRequired() 시그널에 사용됩니다. 이 클래스는 인증이 필요한 서비스에 액세스할 때 필요한 인증 정보를 소켓에 다시 전달하는 방법을 제공합니다.

QAuthenticator는 다음과 같은 인증 방법을 지원합니다:

  • 기본
  • NTLM 버전 2
  • Digest-MD5
  • SPNEGO/협상

옵션

인증에 필요한 사용자 이름과 비밀번호 외에도 QAuthenticator 객체에는 추가 옵션이 포함될 수 있습니다. options () 함수는 서버에서 보내는 수신 옵션을 쿼리하는 데 사용할 수 있으며, setOption() 함수는 인증자 계산에서 처리할 발신 옵션을 설정하는 데 사용할 수 있습니다. 수락 및 제공되는 옵션은 인증 유형에 따라 다릅니다(메서드() 참조).

다음 표에는 알려진 수신 옵션과 허용되는 발신 옵션이 나열되어 있습니다. 서버가 언제든지 추가 정보를 포함할 수 있으므로 들어오는 옵션 목록은 전체 목록이 아닙니다. 그러나 발신 옵션 목록은 전체 목록이며 알 수 없는 옵션은 처리되지 않거나 서버로 다시 전송되지 않습니다.

기본

옵션방향유형설명
realmIncomingQString인증 영역을 포함하며 realm()와 동일합니다.

기본 인증 메커니즘은 발신 옵션을 지원하지 않습니다.

NTLM 버전 2

NTLM 인증 메커니즘은 현재 수신 또는 발신 옵션을 지원하지 않습니다. Windows에서 user 이 설정되어 있지 않으면 로컬 시스템에서 도메인\사용자 자격 증명을 검색하여 통합 인증 기능을 활성화합니다.

Digest-MD5

옵션방향유형설명
realmIncomingQString인증 영역을 포함하며 realm()와 동일합니다.

Digest-MD5 인증 메커니즘은 발신 옵션을 지원하지 않습니다.

SPNEGO/협상

옵션방향유형설명
spn발신QString사용자 지정 SPN을 제공합니다.

이 인증 메커니즘은 현재 수신 옵션을 지원하지 않습니다.

spn 속성은 SSPI 라이브러리를 사용할 때 Windows 클라이언트에서 사용됩니다. 이 속성을 설정하지 않으면 기본 SPN이 사용됩니다. Windows의 기본 SPN은 HTTP/<hostname> 입니다.

다른 운영 체제에서는 GSSAPI 라이브러리를 사용합니다. 이를 위해 KDC가 설정되어 있어야 하며 이 라이브러리에서 자격 증명을 가져올 수 있습니다. 백엔드는 항상 HTTPS@<hostname> 을 SPN으로 사용합니다.

QSslSocket참조하세요 .

멤버 함수 문서

QAuthenticator::QAuthenticator()

빈 인증 객체를 생성합니다.

QAuthenticator::QAuthenticator(const QAuthenticator &other)

other 의 복사본을 생성합니다.

[noexcept] QAuthenticator::~QAuthenticator()

오브젝트를 파괴합니다.

bool QAuthenticator::isNull() const

객체가 초기화되지 않은 경우 true 을 반환합니다. 컨스트가 아닌 멤버 함수가 호출되었거나 콘텐츠가 초기화된 다른 QAuthenticator 객체에서 생성되거나 복사된 경우 false 을 반환합니다.

QVariant QAuthenticator::option(const QString &opt) const

서버에서 설정한 경우 opt 옵션과 관련된 값을 반환합니다. 수신 옵션에 대한 자세한 내용은 Options section 을 참조하세요. opt 옵션을 찾을 수 없는 경우 유효하지 않은 QVariant 이 반환됩니다.

setOption(), options() 및 QAuthenticator options참조하세요 .

QVariantHash QAuthenticator::options() const

서버 응답을 구문 분석하여 이 QAuthenticator 객체에 설정된 모든 수신 옵션을 반환합니다. 수신 옵션에 대한 자세한 내용은 Options section 을 참조하세요.

option() 및 QAuthenticator options도 참조하세요 .

QString QAuthenticator::password() const

인증에 사용된 비밀번호를 반환합니다.

setPassword()도 참조하세요 .

QString QAuthenticator::realm() const

인증이 필요한 영역을 반환합니다.

void QAuthenticator::setOption(const QString &opt, const QVariant &value)

발신 옵션 optvalue 값으로 설정합니다. 발신 옵션에 대한 자세한 내용은 Options section 을 참조하세요.

options(), option() 및 QAuthenticator options참조하세요 .

void QAuthenticator::setPassword(const QString &password)

인증에 사용되는 password 을 설정합니다.

password() 및 QNetworkAccessManager::authenticationRequired()도 참조하세요 .

void QAuthenticator::setUser(const QString &user)

인증에 사용되는 user 을 설정합니다.

user() 및 QNetworkAccessManager::authenticationRequired()도 참조하세요 .

QString QAuthenticator::user() const

인증에 사용된 사용자를 반환합니다.

setUser()도 참조하세요 .

bool QAuthenticator::operator!=(const QAuthenticator &other) const

이 인증자가 other 과 다르면 true 을 반환하고, 그렇지 않으면 false 을 반환합니다.

QAuthenticator &QAuthenticator::operator=(const QAuthenticator &other)

other 의 콘텐츠를 이 인증자에 할당합니다.

bool QAuthenticator::operator==(const QAuthenticator &other) const

이 인증자가 other 과 동일하면 true 을 반환하고, 그렇지 않으면 false 을 반환합니다.

© 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.