QAuthenticator 類提供身份驗證對象。 更多...
| 頭: | #include <QAuthenticator> |
| qmake: | QT += network |
| Since: | Qt 4.3 |
該類在 Qt 4.3 引入。
注意: 此類的所有函數 可重入 .
| QAuthenticator (const QAuthenticator & other ) | |
| QAuthenticator () | |
| QAuthenticator & | operator= (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 |
| bool | operator== (const QAuthenticator & other ) const |
QAuthenticator 類通常用於 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 支持下列身份驗證方法:
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
|
傳入 | QString | 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. On Windows, if no user has been set, domain\user credentials will be searched for on the local system to enable Single-Sign-On functionality.
| 選項 | 方嚮 | 類型 | 描述 |
|---|---|---|---|
realm
|
傳入 | QString | Contains the realm of the authentication, the same as realm () |
The Digest-MD5 authentication mechanism supports no outgoing options.
This authentication mechanism currently supports no incoming or outgoing options.
另請參閱 QSslSocket .
構造副本為 other .
構造空身份驗證對象。
賦值內容對於 other to this authenticator.
銷毀對象。
返迴
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
對象。
Returns the value related to option opt if it was set by the server. See the Options section for more information on incoming options. If option opt isn't found, an invalid QVariant 將被返迴。
該函數在 Qt 4.7 引入。
另請參閱 setOption (), options (),和 QAuthenticator options .
Returns all incoming options set in this QAuthenticator object by parsing the server reply. See the Options section for more information on incoming options.
該函數在 Qt 4.7 引入。
另請參閱 option () 和 QAuthenticator options .
返迴用於身份驗證的口令。
另請參閱 setPassword ().
Returns the realm requiring authentication.
Sets the outgoing option opt to value value 。見 Options section for more information on outgoing options.
該函數在 Qt 4.7 引入。
另請參閱 options (), option (),和 QAuthenticator options .
設置 password 用於身份驗證。
另請參閱 password () 和 QNetworkAccessManager::authenticationRequired ().
設置 user 用於身份驗證。
另請參閱 user () 和 QNetworkAccessManager::authenticationRequired ().
Returns the user used for authentication.
另請參閱 setUser ().
返迴
true
若此身份驗證器不同於
other
;否則返迴
false
.
返迴
true
if this authenticator is identical to
other
;否則返迴
false
.