Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
QAuthenticator Class Reference

The QAuthenticator class provides an authentication object. More...

#include <qauthenticator.h>

+ Collaboration diagram for QAuthenticator:

Public Member Functions

 QAuthenticator ()
 Constructs an empty authentication object.
 
 ~QAuthenticator ()
 Destructs the object.
 
 QAuthenticator (const QAuthenticator &other)
 Constructs a copy of other.
 
QAuthenticatoroperator= (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
 

Detailed Description

The QAuthenticator class provides an authentication object.

Since
4.3

\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

  • Basic
  • NTLM version 2
  • Digest-MD5
  • SPNEGO/Negotiate \endlist

\target qauthenticator-options

Definition at line 17 of file qauthenticator.h.

Constructor & Destructor Documentation

◆ QAuthenticator() [1/2]

QAuthenticator::QAuthenticator ( )

Constructs an empty authentication object.

Definition at line 152 of file qauthenticator.cpp.

◆ ~QAuthenticator()

QAuthenticator::~QAuthenticator ( )

Destructs the object.

Definition at line 160 of file qauthenticator.cpp.

◆ QAuthenticator() [2/2]

QAuthenticator::QAuthenticator ( const QAuthenticator other)

Constructs a copy of other.

Definition at line 169 of file qauthenticator.cpp.

References other().

+ Here is the call graph for this function:

Member Function Documentation

◆ detach()

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().

+ Here is the caller graph for this function:

◆ isNull()

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().

+ Here is the caller graph for this function:

◆ operator!=()

bool QAuthenticator::operator!= ( const QAuthenticator other) const
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().

+ Here is the call graph for this function:

◆ operator=()

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.

+ Here is the call graph for this function:

◆ operator==()

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.

+ Here is the call graph for this function:

◆ option()

QVariant QAuthenticator::option ( const QString opt) const
Since
4.7 Returns the value related to option opt if it was set by the server. See the \l{QAuthenticator::qauthenticator-options}{Options section} for more information on incoming options. If option opt isn't found, an invalid QVariant will be returned.
See also
options(), {QAuthenticator::qauthenticator-options}{QAuthenticator options}

Definition at line 313 of file qauthenticator.cpp.

References opt, QAuthenticatorPrivate::options, and QHash< Key, T >::value().

+ Here is the call graph for this function:

◆ options()

QVariantHash QAuthenticator::options ( ) const
Since
4.7 Returns all incoming options set in this QAuthenticator object by parsing the server reply. See the \l{QAuthenticator::qauthenticator-options}{Options section} for more information on incoming options.
See also
option(), {QAuthenticator::qauthenticator-options}{QAuthenticator options}

Definition at line 326 of file qauthenticator.cpp.

References QAuthenticatorPrivate::options.

◆ password()

QString QAuthenticator::password ( ) const

◆ realm()

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().

+ Here is the caller graph for this function:

◆ setOption()

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

Sets the outgoing option opt to value value. See the \l{QAuthenticator::qauthenticator-options}{Options section} for more information on outgoing options.

See also
options(), option(), {QAuthenticator::qauthenticator-options}{QAuthenticator options}

Definition at line 339 of file qauthenticator.cpp.

References detach(), QHash< Key, T >::insert(), opt, and QAuthenticatorPrivate::options.

+ Here is the call graph for this function:

◆ setPassword()

void QAuthenticator::setPassword ( const QString password)

Sets the password used for authentication.

See also
QNetworkAccessManager::authenticationRequired()

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setRealm()

void QAuthenticator::setRealm ( const QString realm)

Definition at line 296 of file qauthenticator.cpp.

References detach(), realm(), and QAuthenticatorPrivate::realm.

+ Here is the call graph for this function:

◆ setUser()

void QAuthenticator::setUser ( const QString user)

Sets the user used for authentication.

See also
QNetworkAccessManager::authenticationRequired()

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ user()

QString QAuthenticator::user ( ) const

Friends And Related Symbol Documentation

◆ QAuthenticatorPrivate

friend class QAuthenticatorPrivate
friend

Definition at line 45 of file qauthenticator.h.

Referenced by detach().


The documentation for this class was generated from the following files: