QAuthenticatorclass provides an authentication object. 更多 …
QAuthenticatorclass is usually used in theauthenticationRequired()andproxyAuthenticationRequired()signals ofQNetworkAccessManagerandQAbstractSocket. The class provides a way to pass back the required authentication information to the socket when accessing services that require authentication.
QAuthenticatorsupports the following authentication methods:
基本
NTLM version 2
Digest-MD5
SPNEGO/Negotiate
In addition to the username and password required for authentication, a
QAuthenticatorobject can also contain additional options. Theoptions()function can be used to query incoming options sent by the server; thesetOption()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
Type
描述
realmIncoming
QStringContains 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
userhas been set, domain\user credentials will be searched for on the local system to enable Single-Sign-On functionality.
Option
Direction
Type
描述
realmIncoming
QStringContains 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.
另请参阅
QAuthenticator
¶
QAuthenticator(other)
- param other
Constructs an empty authentication object.
构造副本为
other
.
PySide2.QtNetwork.QAuthenticator.
isNull
(
)
¶
bool
返回
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
对象。
PySide2.QtNetwork.QAuthenticator.
__ne__
(
other
)
¶
other
–
QAuthenticator
bool
返回
true
if this authenticator is different from
other
;否则返回
false
.
PySide2.QtNetwork.QAuthenticator.
__eq__
(
other
)
¶
other
–
QAuthenticator
bool
返回
true
if this authenticator is identical to
other
;否则返回
false
.
PySide2.QtNetwork.QAuthenticator.
option
(
opt
)
¶
opt – unicode
object
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
将被返回。
另请参阅
setOption()
options()
QAuthenticator
options
PySide2.QtNetwork.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.
另请参阅
option()
QAuthenticator
options
PySide2.QtNetwork.QAuthenticator.
password
(
)
¶
unicode
返回用于身份验证的口令。
另请参阅
PySide2.QtNetwork.QAuthenticator.
realm
(
)
¶
unicode
Returns the realm requiring authentication.
PySide2.QtNetwork.QAuthenticator.
setOption
(
opt
,
value
)
¶
opt – unicode
value – object
Sets the outgoing option
opt
to value
value
。见
Options
section
for more information on outgoing options.
PySide2.QtNetwork.QAuthenticator.
setPassword
(
password
)
¶
password – unicode
设置
password
used for authentication.
PySide2.QtNetwork.QAuthenticator.
setUser
(
user
)
¶
user – unicode
设置
user
used for authentication.