QAuthenticator 類

The QAuthenticator class provides an authentication object. 更多...

頭: #include <QAuthenticator>
Since: Qt 4.3

注意: 此類的所有函數 可重入 .

公共函數

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

詳細描述

The QAuthenticator class provides an authentication object.

The QAuthenticator class is usually used in the authenticationRequired() and proxyAuthenticationRequired() 信號對於 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:

  • 基本
  • NTLM version 2
  • Digest-MD5

選項

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.

基本

選項 方嚮 描述
realm 傳入 Contains the realm of the authentication, the same as realm ()

The Basic authentication mechanism supports no outgoing options.

NTLM version 2

The NTLM authentication mechanism currently supports no incoming or outgoing options.

Digest-MD5

選項 方嚮 描述
realm 傳入 Contains the realm of the authentication, the same as realm ()

The Digest-MD5 authentication mechanism supports no outgoing options.

另請參閱 QSslSocket .

成員函數文檔編製

QAuthenticator:: QAuthenticator ()

Constructs an empty authentication object

QAuthenticator:: QAuthenticator (const QAuthenticator & other )

構造副本為 other .

QAuthenticator:: ~QAuthenticator ()

Destructs the object

bool QAuthenticator:: isNull () const

Returns true if the authenticator is null.

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

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 將被返迴。

該函數在 Qt 4.7 引入。

另請參閱 setOption (), options (),和 QAuthenticator#Options .

QVariantHash QAuthenticator:: options () const

Returns all incoming options set in this QAuthenticator object by parsing the server reply. See QAuthenticator#Options for more information on incoming options.

該函數在 Qt 4.7 引入。

另請參閱 option () 和 QAuthenticator#Options .

QString QAuthenticator:: password () const

returns the password used for authentication.

另請參閱 setPassword ().

QString QAuthenticator:: realm () const

returns the realm requiring authentication.

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

Sets the outgoing option opt to value value 。見 QAuthenticator#Options for more information on outgoing options.

該函數在 Qt 4.7 引入。

另請參閱 options (), option (),和 QAuthenticator#Options .

void QAuthenticator:: setPassword (const QString & password )

設置 password 用於身份驗證。

另請參閱 password ().

void QAuthenticator:: setUser (const QString & user )

設置 user 用於身份驗證。

另請參閱 user ().

QString QAuthenticator:: user () const

returns the user used for authentication.

另請參閱 setUser ().

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

Returns true if this authenticator is different from other ;否則返迴 false。

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

賦值內容對於 other to this authenticator.

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

Returns true if this authenticator is identical to other ;否則返迴 false。