![]() |
Qt 6.x
The Qt SDK
|
The QAuthenticator class provides an authentication object. More...
#include <qauthenticator.h>
Public Member Functions | |
QAuthenticator () | |
Constructs an empty authentication object. | |
~QAuthenticator () | |
Destructs the object. | |
QAuthenticator (const QAuthenticator &other) | |
Constructs a copy of other. | |
QAuthenticator & | operator= (const QAuthenticator &other) |
Assigns the contents of other to this authenticator. | |
bool | operator== (const QAuthenticator &other) const |
Returns true if this authenticator is identical to other; otherwise returns false . | |
bool | operator!= (const QAuthenticator &other) const |
Returns true if this authenticator is different from other; otherwise returns false . | |
QString | user () const |
Returns the user used for authentication. | |
void | setUser (const QString &user) |
Sets the user used for authentication. | |
QString | password () const |
Returns the password used for authentication. | |
void | setPassword (const QString &password) |
Sets the password used for authentication. | |
QString | realm () const |
Returns the realm requiring authentication. | |
void | setRealm (const QString &realm) |
QVariant | option (const QString &opt) const |
QVariantHash | options () const |
void | setOption (const QString &opt, const QVariant &value) |
bool | isNull () const |
Returns true if the object has not been initialized. | |
void | detach () |
Friends | |
class | QAuthenticatorPrivate |
The QAuthenticator class provides an authentication object.
\reentrant
\inmodule QtNetwork
The QAuthenticator class is usually used in the \l{QNetworkAccessManager::}{authenticationRequired()} and \l{QNetworkAccessManager::}{proxyAuthenticationRequired()} signals of QNetworkAccessManager and QAbstractSocket. The class provides a way to pass back the required authentication information to the socket when accessing services that require authentication.
QAuthenticator supports the following authentication methods: \list
\target qauthenticator-options
Definition at line 17 of file qauthenticator.h.
QAuthenticator::QAuthenticator | ( | ) |
Constructs an empty authentication object.
Definition at line 152 of file qauthenticator.cpp.
QAuthenticator::~QAuthenticator | ( | ) |
Destructs the object.
Definition at line 160 of file qauthenticator.cpp.
QAuthenticator::QAuthenticator | ( | const QAuthenticator & | other | ) |
Constructs a copy of other.
Definition at line 169 of file qauthenticator.cpp.
References other().
void QAuthenticator::detach | ( | ) |
Definition at line 274 of file qauthenticator.cpp.
References QAuthenticatorPrivate::Done, QAuthenticatorPrivate::phase, QAuthenticatorPrivate, and QAuthenticatorPrivate::Start.
Referenced by QHttpNetworkConnectionChannel::ensureConnection(), QHttpNetworkConnectionPrivate::handleAuthenticateChallenge(), operator=(), setOption(), setPassword(), setRealm(), and setUser().
bool QAuthenticator::isNull | ( | ) | const |
Returns true
if the object has not been initialized.
Returns false
if non-const member functions have been called, or the content was constructed or copied from another initialized QAuthenticator object.
Definition at line 354 of file qauthenticator.cpp.
Referenced by QNetworkAccessAuthenticationManager::cacheCredentials(), and QHttpNetworkConnectionPrivate::handleAuthenticateChallenge().
|
inline |
Returns true
if this authenticator is different from other; otherwise returns false
.
Definition at line 27 of file qauthenticator.h.
References operator==(), and other().
QAuthenticator & QAuthenticator::operator= | ( | const QAuthenticator & | other | ) |
Assigns the contents of other to this authenticator.
Definition at line 179 of file qauthenticator.cpp.
References detach(), QAuthenticatorPrivate::extractedUser, QAuthenticatorPrivate::method, QAuthenticatorPrivate::options, other(), QAuthenticatorPrivate::password, QAuthenticatorPrivate::phase, QAuthenticatorPrivate::realm, QAuthenticatorPrivate::Start, QAuthenticatorPrivate::user, QAuthenticatorPrivate::userDomain, and QAuthenticatorPrivate::workstation.
bool QAuthenticator::operator== | ( | const QAuthenticator & | other | ) | const |
Returns true
if this authenticator is identical to other; otherwise returns false
.
Definition at line 208 of file qauthenticator.cpp.
References QAuthenticatorPrivate::method, QAuthenticatorPrivate::options, other(), QAuthenticatorPrivate::password, QAuthenticatorPrivate::realm, and QAuthenticatorPrivate::user.
Definition at line 313 of file qauthenticator.cpp.
References opt, QAuthenticatorPrivate::options, and QHash< Key, T >::value().
QVariantHash QAuthenticator::options | ( | ) | const |
Definition at line 326 of file qauthenticator.cpp.
References QAuthenticatorPrivate::options.
QString QAuthenticator::password | ( | ) | const |
Returns the password used for authentication.
Definition at line 253 of file qauthenticator.cpp.
References QAuthenticatorPrivate::password.
Referenced by QNetworkAccessManagerPrivate::authenticationRequired(), QNetworkAccessAuthenticationManager::cacheCredentials(), QNetworkAccessAuthenticationManager::cacheProxyCredentials(), QHttpNetworkConnectionPrivate::copyCredentials(), QHttpNetworkConnectionPrivate::fillPipeline(), QSocks5SocketEnginePrivate::reauthenticate(), QHttpProtocolHandler::sendRequest(), and setPassword().
QString QAuthenticator::realm | ( | ) | const |
Returns the realm requiring authentication.
Definition at line 288 of file qauthenticator.cpp.
References QAuthenticatorPrivate::realm.
Referenced by QNetworkAccessAuthenticationManager::cacheCredentials(), QNetworkAccessAuthenticationManager::cacheProxyCredentials(), QNetworkAccessAuthenticationManager::fetchCachedCredentials(), QNetworkAccessAuthenticationManager::fetchCachedProxyCredentials(), and setRealm().
Sets the outgoing option opt to value value. See the \l{QAuthenticator::qauthenticator-options}{Options section} for more information on outgoing options.
Definition at line 339 of file qauthenticator.cpp.
References detach(), QHash< Key, T >::insert(), opt, and QAuthenticatorPrivate::options.
Sets the password used for authentication.
Definition at line 263 of file qauthenticator.cpp.
References detach(), password(), and QAuthenticatorPrivate::password.
Referenced by QNetworkAccessManagerPrivate::authenticationRequired(), QHttpNetworkConnectionPrivate::copyCredentials(), QNetworkAccessManagerPrivate::proxyAuthenticationRequired(), QHttpProtocolHandler::sendRequest(), and QHttpThreadDelegate::startRequest().
Definition at line 296 of file qauthenticator.cpp.
References detach(), realm(), and QAuthenticatorPrivate::realm.
Sets the user used for authentication.
Definition at line 241 of file qauthenticator.cpp.
References detach(), QAuthenticatorPrivate::updateCredentials(), user(), and QAuthenticatorPrivate::user.
Referenced by QNetworkAccessManagerPrivate::authenticationRequired(), QHttpNetworkConnectionPrivate::copyCredentials(), QNetworkAccessManagerPrivate::proxyAuthenticationRequired(), QHttpProtocolHandler::sendRequest(), and QHttpThreadDelegate::startRequest().
QString QAuthenticator::user | ( | ) | const |
Returns the user used for authentication.
Definition at line 231 of file qauthenticator.cpp.
References QAuthenticatorPrivate::user.
Referenced by QNetworkAccessManagerPrivate::authenticationRequired(), QNetworkAccessAuthenticationManager::cacheCredentials(), QNetworkAccessAuthenticationManager::cacheProxyCredentials(), QHttpNetworkConnectionPrivate::copyCredentials(), QHttpNetworkConnectionPrivate::fillPipeline(), QSocks5SocketEnginePrivate::reauthenticate(), QHttpProtocolHandler::sendRequest(), and setUser().
|
friend |
Definition at line 45 of file qauthenticator.h.
Referenced by detach().