PySide6.QtNetwork.QAuthenticator¶
- class QAuthenticator¶
The
QAuthenticatorclass provides an authentication object. More…Synopsis¶
Methods¶
def
__init__()def
isNull()def
__ne__()def
__eq__()def
option()def
options()def
password()def
realm()def
setOption()def
setPassword()def
setRealm()def
setUser()def
user()
Note
This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE
Detailed Description¶
The
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:Basic
NTLM version 2
Digest-MD5
SPNEGO/Negotiate
Options¶
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.
Basic¶
Option
Direction
Type
Description
realmIncoming
QString
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. On Windows, if no
userhas been set, domain\user credentials will be searched for on the local system to enable Single-Sign-On functionality.Digest-MD5¶
Option
Direction
Type
Description
realmIncoming
QString
Contains the realm of the authentication, the same as
realm()The Digest-MD5 authentication mechanism supports no outgoing options.
SPNEGO/Negotiate¶
Option
Direction
Type
Description
spnOutgoing
QString
Provides a custom SPN.
This authentication mechanism currently supports no incoming options.
The
spnproperty is used on Windows clients when an SSPI library is used. If the property is not set, a default SPN will be used. The default SPN on Windows isHTTP/<hostname>.Other operating systems use GSSAPI libraries. For that it is expected that KDC is set up, and the credentials can be fetched from it. The backend always uses
HTTPS@<hostname>as an SPN.See also
- __init__()¶
Constructs an empty authentication object.
- __init__(other)
- Parameters:
other –
QAuthenticator
Constructs a copy of
other.- isNull()¶
- Return type:
bool
Returns
trueif the object has not been initialized. Returnsfalseif non-const member functions have been called, or the content was constructed or copied from another initializedQAuthenticatorobject.- __ne__(other)¶
- Parameters:
other –
QAuthenticator- Return type:
bool
Returns
trueif this authenticator is different fromother; otherwise returnsfalse.- __eq__(other)¶
- Parameters:
other –
QAuthenticator- Return type:
bool
Returns
trueif this authenticator is identical toother; otherwise returnsfalse.- option(opt)¶
- Parameters:
opt – str
- Return type:
object
Returns the value related to option
optif it was set by the server. See theOptions sectionfor more information on incoming options. If optionoptisn’t found, an invalid QVariant will be returned.See also
setOption()options()QAuthenticator options- options()¶
- Return type:
Dictionary with keys of type .QString and values of type QVariant.
Returns all incoming options set in this
QAuthenticatorobject by parsing the server reply. See theOptions sectionfor more information on incoming options.See also
option()QAuthenticator options- password()¶
- Return type:
str
Returns the password used for authentication.
See also
- realm()¶
- Return type:
str
Returns the realm requiring authentication.
- setOption(opt, value)¶
- Parameters:
opt – str
value – object
Sets the outgoing option
optto valuevalue. See theOptions sectionfor more information on outgoing options.- setPassword(password)¶
- Parameters:
password – str
Sets the
passwordused for authentication.See also
- setRealm(realm)¶
- Parameters:
realm – str
- setUser(user)¶
- Parameters:
user – str
Sets the
userused for authentication.See also
- user()¶
- Return type:
str
Returns the user used for authentication.
See also