Qt 4.8
|
The QAuthenticator class provides an authentication object. More...
#include <qauthenticator.h>
Public Functions | |
void | detach () |
bool | isNull () const |
Returns true if the authenticator is null. More... | |
bool | operator!= (const QAuthenticator &other) const |
Returns true if this authenticator is different from other; otherwise returns false. More... | |
QAuthenticator & | operator= (const QAuthenticator &other) |
Assigns the contents of other to this authenticator. More... | |
bool | operator== (const QAuthenticator &other) const |
Returns true if this authenticator is identical to other; otherwise returns false. More... | |
QVariant | option (const QString &opt) const |
Returns the value related to option opt if it was set by the server. More... | |
QVariantHash | options () const |
Returns all incoming options set in this QAuthenticator object by parsing the server reply. More... | |
QString | password () const |
returns the password used for authentication. More... | |
QAuthenticator () | |
Constructs an empty authentication object. More... | |
QAuthenticator (const QAuthenticator &other) | |
Constructs a copy of other. More... | |
QString | realm () const |
returns the realm requiring authentication. More... | |
void | setOption (const QString &opt, const QVariant &value) |
Sets the outgoing option opt to value value. More... | |
void | setPassword (const QString &password) |
Sets the password used for authentication. More... | |
void | setUser (const QString &user) |
Sets the user used for authentication. More... | |
QString | user () const |
returns the user used for authentication. More... | |
~QAuthenticator () | |
Destructs the object. More... | |
Properties | |
QAuthenticatorPrivate * | d |
Friends | |
class | QAuthenticatorPrivate |
The QAuthenticator class provides an authentication object.
The QAuthenticator class is usually used in the QNetworkAccessManager::authenticationRequired() and 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:
In addition to the username and password required for authentication, a QAuthenticator object can also contain additional options. The options() function can be used to query incoming options sent by the server; the setOption() function can be used to set outgoing options, to be processed by the authenticator calculation. The options accepted and provided depend on the authentication type (see method()).
The following tables list known incoming options as well as accepted outgoing options. The list of incoming options is not exhaustive, since servers may include additional information at any time. The list of outgoing options is exhaustive, however, and no unknown options will be treated or sent back to the server.
Option | Direction | Description |
realm | Incoming | Contains the realm of the authentication, the same as realm() |
The Basic authentication mechanism supports no outgoing options.
The NTLM authentication mechanism currently supports no incoming or outgoing options.
Option | Direction | Description |
realm | Incoming | Contains the realm of the authentication, the same as realm() |
The Digest-MD5 authentication mechanism supports no outgoing options.
Definition at line 57 of file qauthenticator.h.
QAuthenticator::QAuthenticator | ( | ) |
Constructs an empty authentication object.
Definition at line 137 of file qauthenticator.cpp.
QAuthenticator::~QAuthenticator | ( | ) |
QAuthenticator::QAuthenticator | ( | const QAuthenticator & | other | ) |
void QAuthenticator::detach | ( | ) |
Definition at line 252 of file qauthenticator.cpp.
Referenced by QHttpPrivate::_q_slotReadyRead(), QHttpNetworkConnectionChannel::ensureConnection(), QHttpNetworkConnectionPrivate::handleAuthenticateChallenge(), operator=(), setOption(), setPassword(), and setUser().
bool QAuthenticator::isNull | ( | ) | const |
Returns true if the authenticator is null.
Definition at line 324 of file qauthenticator.cpp.
Referenced by QHttpPrivate::_q_slotReadyRead(), QNetworkAccessFtpBackend::ftpDone(), and QHttpNetworkConnectionPrivate::handleAuthenticateChallenge().
|
inline |
Returns true if this authenticator is different from other; otherwise returns false.
Definition at line 67 of file qauthenticator.h.
QAuthenticator & QAuthenticator::operator= | ( | const QAuthenticator & | other | ) |
Assigns the contents of other to this authenticator.
Definition at line 164 of file qauthenticator.cpp.
bool QAuthenticator::operator== | ( | const QAuthenticator & | other | ) | const |
Returns true if this authenticator is identical to other; otherwise returns false.
Definition at line 193 of file qauthenticator.cpp.
Returns the value related to option opt if it was set by the server.
See QAuthenticator#Options for more information on incoming options. If option opt isn't found, an invalid QVariant will be returned.
Definition at line 282 of file qauthenticator.cpp.
QVariantHash QAuthenticator::options | ( | ) | const |
Returns all incoming options set in this QAuthenticator object by parsing the server reply.
Definition at line 298 of file qauthenticator.cpp.
QString QAuthenticator::password | ( | ) | const |
returns the password used for authentication.
Definition at line 235 of file qauthenticator.cpp.
Referenced by QNetworkAccessAuthenticationManager::cacheCredentials(), QNetworkAccessAuthenticationManager::cacheProxyCredentials(), QHttpNetworkConnectionPrivate::copyCredentials(), QHttpNetworkConnectionPrivate::fillPipeline(), QNetworkAccessFtpBackend::ftpDone(), QSocks5SocketEnginePrivate::reauthenticate(), QHttpNetworkConnectionChannel::sendRequest(), and setPassword().
QString QAuthenticator::realm | ( | ) | const |
returns the realm requiring authentication.
Definition at line 266 of file qauthenticator.cpp.
Referenced by QNetworkAccessAuthenticationManager::cacheCredentials(), QNetworkAccessAuthenticationManager::cacheProxyCredentials(), QNetworkAccessAuthenticationManager::fetchCachedCredentials(), and QNetworkAccessAuthenticationManager::fetchCachedProxyCredentials().
Sets the outgoing option opt to value value.
See QAuthenticator#Options for more information on outgoing options.
Definition at line 314 of file qauthenticator.cpp.
void QAuthenticator::setPassword | ( | const QString & | password | ) |
Sets the password used for authentication.
Definition at line 243 of file qauthenticator.cpp.
Referenced by QNetworkAccessManagerPrivate::authenticationRequired(), QHttpNetworkConnectionPrivate::copyCredentials(), QNetworkAccessManagerPrivate::proxyAuthenticationRequired(), QHttpNetworkConnectionChannel::sendRequest(), QHttpThreadDelegate::synchronousAuthenticationRequiredSlot(), and QHttpThreadDelegate::synchronousProxyAuthenticationRequiredSlot().
void QAuthenticator::setUser | ( | const QString & | user | ) |
Sets the user used for authentication.
Definition at line 225 of file qauthenticator.cpp.
Referenced by QNetworkAccessManagerPrivate::authenticationRequired(), QHttpNetworkConnectionPrivate::copyCredentials(), QNetworkAccessManagerPrivate::proxyAuthenticationRequired(), QHttpNetworkConnectionChannel::sendRequest(), QHttpThreadDelegate::synchronousAuthenticationRequiredSlot(), and QHttpThreadDelegate::synchronousProxyAuthenticationRequiredSlot().
QString QAuthenticator::user | ( | ) | const |
returns the user used for authentication.
Definition at line 217 of file qauthenticator.cpp.
Referenced by QNetworkAccessAuthenticationManager::cacheCredentials(), QNetworkAccessAuthenticationManager::cacheProxyCredentials(), QHttpNetworkConnectionPrivate::copyCredentials(), QHttpNetworkConnectionPrivate::fillPipeline(), QNetworkAccessFtpBackend::ftpDone(), QSocks5SocketEnginePrivate::reauthenticate(), QHttpNetworkConnectionChannel::sendRequest(), and setUser().
|
friend |
Definition at line 84 of file qauthenticator.h.
Referenced by detach().
|
private |
Definition at line 85 of file qauthenticator.h.
Referenced by detach(), QAuthenticatorPrivate::getPrivate(), isNull(), operator=(), operator==(), option(), options(), password(), QAuthenticator(), realm(), setOption(), setPassword(), setUser(), user(), and ~QAuthenticator().