QAuthenticator Class
QAuthenticator 클래스는 인증 객체를 제공합니다. 더 보기...
| 헤더: | #include <QAuthenticator> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS Network) target_link_libraries(mytarget PRIVATE Qt6::Network) |
| qmake: | QT += network |
- 상속된 멤버를 포함한 모든 멤버 목록
- QAuthenticator는 네트워크 프로그래밍 API의 일부입니다.
참고: 이 클래스의 모든 함수는 재진입 가능합니다.
공개 함수
| QAuthenticator() | |
| QAuthenticator(const QAuthenticator &other) | |
| ~QAuthenticator() | |
(since 6.11) void | clear() |
| 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 클래스는 일반적으로 QNetworkAccessManager 및 QAbstractSocket 의 authenticationRequired() 및 proxyAuthenticationRequired() 신호에서 사용됩니다. 이 클래스는 인증이 필요한 서비스에 액세스할 때 필요한 인증 정보를 소켓으로 다시 전달하는 방법을 제공합니다.
QAuthenticator는 다음 인증 방법을 지원합니다:
- Basic
- NTLM 버전 2
- Digest-MD5
- SPNEGO/Negotiate
옵션
인증에 필요한 사용자 이름과 비밀번호 외에도, QAuthenticator 객체에는 추가 옵션이 포함될 수 있습니다. options() 함수를 사용하면 서버에서 전송된 수신 옵션을 조회할 수 있으며, setOption() 함수를 사용하면 인증자 계산 과정에서 처리될 발신 옵션을 설정할 수 있습니다. 허용 및 제공되는 옵션은 인증 유형에 따라 다릅니다(method() 참조).
다음 표에는 알려진 수신 옵션과 허용되는 발신 옵션이 나열되어 있습니다. 서버 측에서 언제든지 추가 정보를 포함할 수 있으므로, 수신 옵션 목록은 완전한 것이 아닙니다. 반면, 발신 옵션 목록은 완전하며, 알려지지 않은 옵션은 처리되거나 서버로 다시 전송되지 않습니다.
기본
기본(Basic) 인증 메커니즘은 발신 옵션을 지원하지 않습니다.
NTLM 버전 2
NTLM 인증 메커니즘은 현재 인바운드 또는 아웃바운드 옵션을 지원하지 않습니다. Windows에서 ‘ user ’가 설정되어 있지 않은 경우, 싱글 사인온(SSO) 기능을 활성화하기 위해 로컬 시스템에서 도메인\user 자격 증명을 검색합니다.
Digest-MD5
Digest-MD5 인증 메커니즘은 발신 옵션을 지원하지 않습니다.
SPNEGO/Negotiate
| 옵션 | 방향 | 유형 | 설명 |
|---|---|---|---|
spn | 발신 | QString | 사용자 지정 SPN을 제공합니다. |
이 인증 메커니즘은 현재 수신 옵션을 지원하지 않습니다.
spn 속성은 SSPI 라이브러리를 사용할 때 Windows 클라이언트에서 사용됩니다. 이 속성이 설정되지 않은 경우 기본 SPN이 사용됩니다. Windows의 기본 SPN은 HTTP/<hostname> 입니다.
다른 운영 체제에서는 GSSAPI 라이브러리를 사용합니다. 이 경우 KDC가 설정되어 있어야 하며, KDC에서 자격 증명을 가져올 수 있어야 합니다. 백엔드는 항상 HTTPS@<hostname> 을 SPN으로 사용합니다.
보안 고려 사항
QAuthenticator는 사용자 이름 및 비밀번호와 같은 자격 증명을 내부적으로 범용 데이터 유형(QString, QByteArray)을 사용하여 저장하며, 이러한 데이터 유형은 객체 소멸 시 메모리에서 해당 내용이 안전하게 삭제된다는 보장을 하지 않습니다. QAuthenticator 객체가 소멸되거나 초기화된 후에도 자격 증명 정보가 해제된 힙 페이지, 코어 덤프, 스왑 파일 또는 프로세스 메모리에 남아 있을 수 있습니다.
기본(Basic) 인증이 협상될 때, 자격 증명은 Base64 인코딩을 사용하여 전송되는데, 이는 매우 쉽게 복호화될 수 있습니다. 기본 인증은 TLS로 암호화된 연결에서만 사용해야 합니다. QAuthenticator는 이 요구 사항을 강제하지 않으며, 기본 인증을 사용할 때 전송 보안을 보장하는 것은 애플리케이션의 책임입니다.
QAuthenticator는 고정된 내부 우선순위 순서(Negotiate(Kerberos/SPNEGO), NTLM, Digest-MD5, Basic)를 사용하여 서버가 제공하는 가장 강력한 인증 방식을 선택합니다. 현재 애플리케이션은 이 선택 과정에 영향을 미치거나 허용되는 인증 방식을 제한할 수 없습니다. 서버나 프록시가 취약한 인증 방식만 제공하는 경우, 별도의 알림 없이 해당 방식이 사용됩니다.
인증 정보 관리에 엄격한 요구 사항이 있는 애플리케이션은 QAuthenticator를 어떻게, 어디에서 사용할지 결정할 때 이 점을 고려해야 합니다.
QSslSocket도 참조하십시오 .
멤버 함수 문서
QAuthenticator::QAuthenticator()
빈 인증 객체를 생성합니다.
QAuthenticator::QAuthenticator(const QAuthenticator &other)
other 의 복사본을 생성합니다.
[noexcept] QAuthenticator::~QAuthenticator()
객체를 삭제합니다.
[since 6.11] void QAuthenticator::clear()
모든 자격 증명을 지우고 객체를 초기화되지 않은 기본 상태로 재설정합니다.
이 함수는 Qt 6.11에서 도입되었습니다.
bool QAuthenticator::isNull() const
객체가 초기화되지 않은 경우 ` true `을 반환합니다. 비const 멤버 함수가 호출되었거나, 내용이 다른 초기화된 ` 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)
opt 발신 옵션을 value 값으로 설정합니다. 발신 옵션에 대한 자세한 내용은 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 를 반환합니다.
© 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.