QAuthenticator Class Reference

[ QtNetwork module]

QAuthenticator 类提供身份验证对象。 更多...

方法

Special Methods


详细描述

QAuthenticator 类提供身份验证对象。

QAuthenticator 类通常用于 authenticationRequired() and 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 () 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 描述
realm Incoming Contains the realm of the authentication, the same as realm ()

The Basic authentication mechanism supports no outgoing 选项。

NTLM version 2

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

Digest-MD5

Option Direction 描述
realm Incoming Contains the realm of the authentication, the same as realm ()

The Digest-MD5 authentication mechanism supports no outgoing 选项。


方法文档编制

QAuthenticator.__init__ ( self )

Constructs an empty authentication object

QAuthenticator.__init__ ( self , QAuthenticator   other )

构造副本为 other .

bool QAuthenticator.isNull ( self )

Returns true if the authenticator is null.

QVariant QAuthenticator.option ( self , QString  opt )

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 将是 returned.

该函数在 Qt 4.7 引入。

另请参阅 setOption (), options (),和 QAuthenticator#Options .

dict-of-QString-QVariant QAuthenticator.options ( self )

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

returns the password used for authentication.

另请参阅 setPassword ().

QString QAuthenticator.realm ( self )

returns the realm requiring authentication.

QAuthenticator.setOption ( self , QString  opt , 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 .

QAuthenticator.setPassword ( self , QString  password )

设置 password used for authentication.

另请参阅 password ().

QAuthenticator.setUser ( self , QString  user )

设置 user used for authentication.

另请参阅 user ().

QString QAuthenticator.user ( self )

returns the user used for authentication.

另请参阅 setUser ().

bool QAuthenticator.__eq__ ( self , QAuthenticator   other )

bool QAuthenticator.__ne__ ( self , QAuthenticator   other )