Soup.Auth¶
- Subclasses:
Soup.AuthBasic
,Soup.AuthDigest
,Soup.AuthNTLM
,Soup.AuthNegotiate
Methods¶
- Inherited:
- Structs:
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
|
|
|
|
|
|
|
|
|
Properties¶
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w |
Authentication host |
||
r |
Whether or not the auth is authenticated |
||
r/w |
Whether or not the auth is for a proxy server |
||
r/w |
Authentication realm |
||
r |
Authentication scheme name |
Signals¶
- Inherited:
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
parent |
r |
||
realm |
r |
Class Details¶
- class Soup.Auth(**kwargs)¶
- Bases:
- Abstract:
Yes
- Structure:
The 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.Message
the auth is being created forauth_header (
str
) – the WWW-Authenticate/Proxy-Authenticate header
- Returns:
- Return type:
Creates a new
Soup.Auth
of type type with the information from msg and auth_header.This is called by
Soup.Session
; you will normally not create auths yourself.
- 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()¶
-
Tests if self is able to authenticate by providing credentials to the
Soup.Auth.authenticate
().New in version 2.54.
- get_authorization(msg)¶
- Parameters:
msg (
Soup.Message
) – theSoup.Message
to be authorized- Returns:
the “Authorization” header, which must be freed.
- Return type:
Generates 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:
Gets an opaque identifier for self, for use as a hash key or the like.
Soup.Auth
objects 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:
Returns 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:
Returns self's scheme name. (Eg, “Basic”, “Digest”, or “NTLM”)
- is_authenticated()¶
-
Tests if self has been given a username and password
- is_for_proxy()¶
-
Tests whether or not self is associated with a proxy server rather than an “origin” server.
- is_ready(msg)¶
- Parameters:
msg (
Soup.Message
) – aSoup.Message
- Returns:
True
if self is ready to make a request with.- Return type:
Tests 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.Message
self is being updated forauth_header (
str
) – the WWW-Authenticate/Proxy-Authenticate header
- Returns:
True
if self is still a valid (but potentially unauthenticated)Soup.Auth
.False
if 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
.
- 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¶
-
Tests if auth is able to authenticate by providing credentials to the
Soup.Auth.authenticate
().New in version 2.54.
- do_get_authorization(msg) virtual¶
- Parameters:
msg (
Soup.Message
) – theSoup.Message
to be authorized- Returns:
the “Authorization” header, which must be freed.
- Return type:
Generates 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¶
-
Tests if auth has been given a username and password
- do_is_ready(msg) virtual¶
- Parameters:
msg (
Soup.Message
) – aSoup.Message
- Returns:
True
if auth is ready to make a request with.- Return type:
Tests 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.Message
auth is being updated forauth_header ({
object
:object
}) – the WWW-Authenticate/Proxy-Authenticate header
- Returns:
True
if auth is still a valid (but potentially unauthenticated)Soup.Auth
.False
if 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
.
Property Details¶
- Soup.Auth.props.host¶
-
Authentication host
- Soup.Auth.props.is_authenticated¶
-
Whether or not the auth is authenticated
- Soup.Auth.props.is_for_proxy¶
-
Whether or not the auth is for a proxy server
- Soup.Auth.props.realm¶
-
Authentication realm