Soup.Auth¶
| Subclasses: | Soup.AuthBasic, Soup.AuthDigest, Soup.AuthNTLM, Soup.AuthNegotiate |
|---|
Methods¶
| Inherited: | GObject.Object (37) |
|---|---|
| Structs: | GObject.ObjectClass (5) |
| class | new (type, msg, auth_header) |
authenticate (username, password) |
|
can_authenticate () |
|
get_authorization (msg) |
|
get_host () |
|
get_info () |
|
get_protection_space (source_uri) |
|
get_realm () |
|
get_saved_password (user) |
|
get_saved_users () |
|
get_scheme_name () |
|
has_saved_password (username, password) |
|
is_authenticated () |
|
is_for_proxy () |
|
is_ready (msg) |
|
save_password (username, password) |
|
update (msg, auth_header) |
Virtual Methods¶
| Inherited: | GObject.Object (7) |
|---|
do_authenticate (username, password) |
|
do_can_authenticate () |
|
do_get_authorization (msg) |
|
do_get_protection_space (source_uri) |
|
do_is_authenticated () |
|
do_is_ready (msg) |
|
do_update (msg, auth_header) |
Properties¶
| Name | Type | Flags | Short Description |
|---|---|---|---|
host |
str |
r/w | Authentication host |
is-authenticated |
bool |
r | Whether or not the auth is authenticated |
is-for-proxy |
bool |
r/w | Whether or not the auth is for a proxy server |
realm |
str |
r/w | Authentication realm |
scheme-name |
str |
r | Authentication scheme name |
Signals¶
| Inherited: | GObject.Object (1) |
|---|
Fields¶
| Inherited: | GObject.Object (1) |
|---|
| Name | Type | Access | Description |
|---|---|---|---|
| parent | GObject.Object |
r | |
| realm | str |
r |
Class Details¶
-
class
Soup.Auth(**kwargs)¶ Bases: GObject.ObjectAbstract: Yes Structure: Soup.AuthClassThe abstract base class for handling authentication. Specific HTTP Authentication mechanisms are implemented by its subclasses, but applications never need to be aware of the specific subclasses being used.
-
classmethod
new(type, msg, auth_header)¶ Parameters: - type (
GObject.GType) – the type of auth to create (a subtype ofSoup.Auth) - msg (
Soup.Message) – theSoup.Messagethe auth is being created for - auth_header (
str) – the WWW-Authenticate/Proxy-Authenticate header
Returns: Return type: Creates a new
Soup.Authof type type with the information from msg and auth_header.This is called by
Soup.Session; you will normally not create auths yourself.- type (
-
authenticate(username, password)¶ Parameters: Call this on an auth to authenticate it; normally this will cause the auth’s message to be requeued with the new authentication info.
-
can_authenticate()¶ Returns: Trueif self is able to accept credentials.Return type: boolTests if self is able to authenticate by providing credentials to the
Soup.Auth.authenticate().New in version 2.54.
Parameters: msg ( Soup.Message) – theSoup.Messageto be authorizedReturns: the “Authorization” header, which must be freed. Return type: strGenerates an appropriate “Authorization” header for msg. (The session will only call this if
Soup.Auth.is_authenticated() returnedTrue.)
-
get_info()¶ Returns: the identifier Return type: strGets an opaque identifier for self, for use as a hash key or the like.
Soup.Authobjects from the same server with the same identifier refer to the same authentication domain (eg, the URLs associated with them take the same usernames and passwords).
-
get_protection_space(source_uri)¶ Parameters: source_uri ( Soup.URI) – the URI of the request that self was generated in response to.Returns: the list of paths, which can be freed with soup_auth_free_protection_space(). Return type: [ str]Returns a list of paths on the server which self extends over. (All subdirectories of these paths are also assumed to be part of self’s protection space, unless otherwise discovered not to be.)
-
get_realm()¶ Returns: the realm name Return type: strReturns self’s realm. This is an identifier that distinguishes separate authentication spaces on a given server, and may be some string that is meaningful to the user. (Although it is probably not localized.)
-
get_scheme_name()¶ Returns: the scheme name Return type: strReturns self’s scheme name. (Eg, “Basic”, “Digest”, or “NTLM”)
-
is_authenticated()¶ Returns: Trueif self has been given a username and passwordReturn type: boolTests if self has been given a username and password
-
is_for_proxy()¶ Returns: TrueorFalseReturn type: boolTests whether or not self is associated with a proxy server rather than an “origin” server.
-
is_ready(msg)¶ Parameters: msg ( Soup.Message) – aSoup.MessageReturns: Trueif self is ready to make a request with.Return type: boolTests if self is ready to make a request for msg with. For most auths, this is equivalent to
Soup.Auth.is_authenticated(), but for some auth types (eg, NTLM), the auth may be sendable (eg, as an authentication request) even before it is authenticated.New in version 2.42.
-
update(msg, auth_header)¶ Parameters: - msg (
Soup.Message) – theSoup.Messageself is being updated for - auth_header (
str) – the WWW-Authenticate/Proxy-Authenticate header
Returns: Trueif self is still a valid (but potentially unauthenticated)Soup.Auth.Falseif something about auth_params could not be parsed or incorporated into self at all.Return type: Updates self with the information from msg and auth_header, possibly un-authenticating it. As with
Soup.Auth.new(), this is normally only used bySoup.Session.- msg (
-
do_authenticate(username, password) virtual¶ Parameters: Call this on an auth to authenticate it; normally this will cause the auth’s message to be requeued with the new authentication info.
-
do_can_authenticate() virtual¶ Returns: Trueif auth is able to accept credentials.Return type: boolTests if auth is able to authenticate by providing credentials to the
Soup.Auth.authenticate().New in version 2.54.
Parameters: msg ( Soup.Message) – theSoup.Messageto be authorizedReturns: the “Authorization” header, which must be freed. Return type: strGenerates an appropriate “Authorization” header for msg. (The session will only call this if
Soup.Auth.is_authenticated() returnedTrue.)
-
do_get_protection_space(source_uri) virtual¶ Parameters: source_uri ( Soup.URI) – the URI of the request that auth was generated in response to.Returns: the list of paths, which can be freed with soup_auth_free_protection_space(). Return type: [ str]Returns a list of paths on the server which auth extends over. (All subdirectories of these paths are also assumed to be part of auth’s protection space, unless otherwise discovered not to be.)
-
do_is_authenticated() virtual¶ Returns: Trueif auth has been given a username and passwordReturn type: boolTests if auth has been given a username and password
-
do_is_ready(msg) virtual¶ Parameters: msg ( Soup.Message) – aSoup.MessageReturns: Trueif auth is ready to make a request with.Return type: boolTests if auth is ready to make a request for msg with. For most auths, this is equivalent to
Soup.Auth.is_authenticated(), but for some auth types (eg, NTLM), the auth may be sendable (eg, as an authentication request) even before it is authenticated.New in version 2.42.
-
do_update(msg, auth_header) virtual¶ Parameters: - msg (
Soup.Message) – theSoup.Messageauth is being updated for - auth_header ({
object:object}) – the WWW-Authenticate/Proxy-Authenticate header
Returns: Trueif auth is still a valid (but potentially unauthenticated)Soup.Auth.Falseif something about auth_params could not be parsed or incorporated into auth at all.Return type: Updates auth with the information from msg and auth_header, possibly un-authenticating it. As with
Soup.Auth.new(), this is normally only used bySoup.Session.- msg (
-
classmethod
Property Details¶
-
Soup.Auth.props.host¶ Name: hostType: strDefault Value: NoneFlags: READABLE,WRITABLEAuthentication host
-
Soup.Auth.props.is_authenticated¶ Name: is-authenticatedType: boolDefault Value: FalseFlags: READABLEWhether or not the auth is authenticated
-
Soup.Auth.props.is_for_proxy¶ Name: is-for-proxyType: boolDefault Value: FalseFlags: READABLE,WRITABLEWhether or not the auth is for a proxy server