1.1 <SoupAuth>

Class: <SoupAuth>

It derives from <GObject>.

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.

Auth objects store the authentication data associated with a given bit of web space. They are created automatically by Session.

Fields

parent-instance

Properties

Property: auth:authority self

The authority (host:port) being authenticated to.

Its value is a string, or #f.

Set it with (set! (auth:authority self) value).

Property: auth:is-authenticated self

Whether or not the auth has been authenticated.

Its value is a boolean.

It is read only.

Property: auth:is-cancelled self

Whether or not the auth has been cancelled.

Its value is a boolean.

It is read only.

Property: auth:is-for-proxy self

Whether or not the auth is for a proxy server.

Its value is a boolean.

Set it with (set! (auth:is-for-proxy self) value).

Property: auth:realm self

The authentication realm.

Its value is a string, or #f.

Set it with (set! (auth:realm self) value).

Property: auth:scheme-name self

The authentication scheme name.

Its value is a string, or #f.

It is read only.

Procedures

Method: auth:authenticate self username password
Method: authenticate self username password

Call this on an auth to authenticate it.

Normally this will cause the auth’s message to be requeued with the new authentication info.

self

Passed: a <SoupAuth>.

a <SoupAuth>

username

Passed: a string.

the username provided by the user or client

password

Passed: a string.

the password provided by the user or client

Method: auth:can-authenticate? self ⇒ %return
Method: can-authenticate? self ⇒ %return

Tests if self is able to authenticate by providing credentials to the Auth.authenticate.

self

Passed: a <SoupAuth>.

a <SoupAuth>

%return

Returned: a boolean.

#t if self is able to accept credentials.

Method: auth:cancel self
Method: cancel self

Call this on an auth to cancel it.

You need to cancel an auth to complete an asynchronous authenticate operation when no credentials are provided (Auth.authenticate is not called). The Auth will be cancelled on dispose if it hasn’t been authenticated.

self

Passed: a <SoupAuth>.

a <SoupAuth>

Method: auth:get-authority self ⇒ %return
Method: get-authority self ⇒ %return

Returns the authority (host:port) that self is associated with.

self

Passed: a <SoupAuth>.

a <SoupAuth>

%return

Returned: a string.

the authority

Method: auth:get-authorization self msg ⇒ %return
Method: get-authorization self msg ⇒ %return

Generates an appropriate "Authorization" header for msg.

(The session will only call this if Auth.is_authenticated returned #t.)

self

Passed: a <SoupAuth>.

a <SoupAuth>

msg

Passed: a <SoupMessage>.

the <SoupMessage> to be authorized

%return

Returned: a string.

the "Authorization" header, which must be freed.

Method: auth:get-info self ⇒ %return
Method: get-info self ⇒ %return

Gets an opaque identifier for self.

The identifier can be used as a hash key or the like. 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).

self

Passed: a <SoupAuth>.

a <SoupAuth>

%return

Returned: a string.

the identifier

Method: auth:get-protection-space self source-uri ⇒ %return
Method: get-protection-space self source-uri ⇒ %return

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.)

self

Passed: a <SoupAuth>.

a <SoupAuth>

source-uri

Passed: a <GUri>.

the URI of the request that self was generated in response to.

%return

Returned: a list, each a string.

the list of paths, which can be freed with Auth.free_protection_space.

Method: auth:get-realm self ⇒ %return
Method: get-realm self ⇒ %return

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.)

self

Passed: a <SoupAuth>.

a <SoupAuth>

%return

Returned: a string.

the realm name

Method: auth:get-scheme-name self ⇒ %return
Method: get-scheme-name self ⇒ %return

soup_auth_get_scheme_name: (attributes org.gtk.Method.get_property=scheme-name) Returns self’s scheme name. (Eg, "Basic", "Digest", or "NTLM")

self

Passed: a <SoupAuth>.

a <SoupAuth>

%return

Returned: a string.

the scheme name

Method: auth:is-authenticated? self ⇒ %return
Method: is-authenticated? self ⇒ %return

Tests if self has been given a username and password.

self

Passed: a <SoupAuth>.

a <SoupAuth>

%return

Returned: a boolean.

#t if self has been given a username and password

Method: auth:is-cancelled? self ⇒ %return
Method: is-cancelled? self ⇒ %return

Tests if self has been cancelled

self

Passed: a <SoupAuth>.

a <SoupAuth>

%return

Returned: a boolean.

#t if self has been cancelled

Method: auth:is-for-proxy? self ⇒ %return
Method: is-for-proxy? self ⇒ %return

Tests whether or not self is associated with a proxy server rather than an "origin" server.

self

Passed: a <SoupAuth>.

a <SoupAuth>

%return

Returned: a boolean.

#t or #f

Method: auth:is-ready? self msg ⇒ %return
Method: is-ready? self msg ⇒ %return

Tests if self is ready to make a request for msg with.

For most auths, this is equivalent to 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.

self

Passed: a <SoupAuth>.

a <SoupAuth>

msg

Passed: a <SoupMessage>.

a <SoupMessage>

%return

Returned: a boolean.

#t if self is ready to make a request with.

Procedure: auth:new type msg auth-header ⇒ %return

Creates a new Auth of type type with the information from msg and auth-header.

This is called by Session; you will normally not create auths yourself.

type

Passed: a class, or a GType number.

the type of auth to create (a subtype of Auth)

msg

Passed: a <SoupMessage>.

the <SoupMessage> the auth is being created for

auth-header

Passed: a string.

the WWW-Authenticate/Proxy-Authenticate header

%return

Returned: a <SoupAuth>, or #f.

the new Auth, or #f if it could not be created

Method: auth:update? self msg auth-header ⇒ %return
Method: update? self msg auth-header ⇒ %return

Updates self with the information from msg and auth-header, possibly un-authenticating it.

As with Auth.new, this is normally only used by Session.

self

Passed: a <SoupAuth>.

a <SoupAuth>

msg

Passed: a <SoupMessage>.

the <SoupMessage> self is being updated for

auth-header

Passed: a string.

the WWW-Authenticate/Proxy-Authenticate header

%return

Returned: a boolean.

#t if self is still a valid (but potentially unauthenticated) Auth. #f if something about auth-params could not be parsed or incorporated into self at all.

Virtual methods

Virtual method: auth:do-authenticate implementor self username password

Call this on an auth to authenticate it.

Normally this will cause the auth’s message to be requeued with the new authentication info.

To override it in a new class, give register-type #:vfuncs `((authenticate . ,procedure)). The procedure is called as (procedure self username password).

implementor

Passed: the class whose implementation to call: <SoupAuth>, or a class that derives from it, or its GType number.

self

Passed: a <SoupAuth>.

a <SoupAuth>

username

Passed: a string.

the username provided by the user or client

password

Passed: a string.

the password provided by the user or client

Virtual method: auth:do-can-authenticate implementor self ⇒ %return

Tests if self is able to authenticate by providing credentials to the Auth.authenticate.

To override it in a new class, give register-type #:vfuncs `((can-authenticate . ,procedure)). The procedure is called as (procedure self) ⇒ %return.

implementor

Passed: the class whose implementation to call: <SoupAuth>, or a class that derives from it, or its GType number.

self

Passed: a <SoupAuth>.

a <SoupAuth>

%return

Returned: a boolean.

#t if self is able to accept credentials.

Virtual method: auth:do-get-authorization implementor self msg ⇒ %return

Generates an appropriate "Authorization" header for msg.

(The session will only call this if Auth.is_authenticated returned #t.)

To override it in a new class, give register-type #:vfuncs `((get-authorization . ,procedure)). The procedure is called as (procedure self msg) ⇒ %return.

implementor

Passed: the class whose implementation to call: <SoupAuth>, or a class that derives from it, or its GType number.

self

Passed: a <SoupAuth>.

a <SoupAuth>

msg

Passed: a <SoupMessage>.

the <SoupMessage> to be authorized

%return

Returned: a string.

the "Authorization" header, which must be freed.

Virtual method: auth:do-get-protection-space implementor self source-uri ⇒ %return

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.)

To override it in a new class, give register-type #:vfuncs `((get-protection-space . ,procedure)). The procedure is called as (procedure self source-uri) ⇒ %return.

implementor

Passed: the class whose implementation to call: <SoupAuth>, or a class that derives from it, or its GType number.

self

Passed: a <SoupAuth>.

a <SoupAuth>

source-uri

Passed: a <GUri>.

the URI of the request that self was generated in response to.

%return

Returned: a list, each a string.

the list of paths, which can be freed with Auth.free_protection_space.

Virtual method: auth:do-is-authenticated implementor self ⇒ %return

Tests if self has been given a username and password.

To override it in a new class, give register-type #:vfuncs `((is-authenticated . ,procedure)). The procedure is called as (procedure self) ⇒ %return.

implementor

Passed: the class whose implementation to call: <SoupAuth>, or a class that derives from it, or its GType number.

self

Passed: a <SoupAuth>.

a <SoupAuth>

%return

Returned: a boolean.

#t if self has been given a username and password

Virtual method: auth:do-is-ready implementor self msg ⇒ %return

Tests if self is ready to make a request for msg with.

For most auths, this is equivalent to 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.

To override it in a new class, give register-type #:vfuncs `((is-ready . ,procedure)). The procedure is called as (procedure self msg) ⇒ %return.

implementor

Passed: the class whose implementation to call: <SoupAuth>, or a class that derives from it, or its GType number.

self

Passed: a <SoupAuth>.

a <SoupAuth>

msg

Passed: a <SoupMessage>.

a <SoupMessage>

%return

Returned: a boolean.

#t if self is ready to make a request with.

Virtual method: auth:do-update implementor self msg auth-header ⇒ %return

Updates self with the information from msg and auth-header, possibly un-authenticating it.

As with Auth.new, this is normally only used by Session.

To override it in a new class, give register-type #:vfuncs `((update . ,procedure)). The procedure is called as (procedure self msg auth-header) ⇒ %return.

implementor

Passed: the class whose implementation to call: <SoupAuth>, or a class that derives from it, or its GType number.

self

Passed: a <SoupAuth>.

a <SoupAuth>

msg

Passed: a <SoupMessage>.

the <SoupMessage> self is being updated for

auth-header

Passed: a hash table, each key a foreign pointer and each value a foreign pointer.

the WWW-Authenticate/Proxy-Authenticate header

%return

Returned: a boolean.

#t if self is still a valid (but potentially unauthenticated) Auth. #f if something about auth-params could not be parsed or incorporated into self at all.