1.4 <SoupAuthDomain>

Class: <SoupAuthDomain>

It derives from <GObject>.

Server-side authentication.

A AuthDomain manages authentication for all or part of a Server. To make a server require authentication, first create an appropriate subclass of AuthDomain, and then add it to the server with Server.add_auth_domain.

In order for an auth domain to have any effect, you must add one or more paths to it (via AuthDomain.add_path). To require authentication for all ordinary requests, add the path "/". (Note that this does not include the special "*" URI (eg, "OPTIONS *"), which must be added as a separate path if you want to cover it.)

If you need greater control over which requests should and shouldn’t be authenticated, add paths covering everything you might want authenticated, and then use a filter (AuthDomain.set_filter to bypass authentication for those requests that don’t need it.

Fields

parent-instance

Properties

Property: auth-domain:filter self

The AuthDomainFilter for the domain.

Its value is a foreign pointer (or, to set it, a bytevector).

Set it with (set! (auth-domain:filter self) value).

Property: auth-domain:filter-data self

Data to pass to the AuthDomainFilter.

Its value is a foreign pointer (or, to set it, a bytevector).

Set it with (set! (auth-domain:filter-data self) value).

Property: auth-domain:generic-auth-callback self

The AuthDomainGenericAuthCallback.

Its value is a foreign pointer (or, to set it, a bytevector).

Set it with (set! (auth-domain:generic-auth-callback self) value).

Property: auth-domain:generic-auth-data self

The data to pass to the AuthDomainGenericAuthCallback.

Its value is a foreign pointer (or, to set it, a bytevector).

Set it with (set! (auth-domain:generic-auth-data self) value).

Property: auth-domain:proxy self

Whether or not this is a proxy auth domain.

Its value is a boolean.

It can only be set when the object is made, with #:proxy.

Property: auth-domain:realm self

The realm of this auth domain.

Its value is a string, or #f.

It can only be set when the object is made, with #:realm.

Procedures

Method: auth-domain:accepts self msg ⇒ %return
Method: accepts self msg ⇒ %return

Checks if msg contains appropriate authorization for self to accept it.

Mirroring AuthDomain.covers, this does not check whether or not self cares if msg is authorized.

This is used by Server internally and is probably of no use to anyone else.

self

Passed: a <SoupAuthDomain>.

a <SoupAuthDomain>

msg

Passed: a <SoupServerMessage>.

a <SoupServerMessage>

%return

Returned: a string, or #f.

the username that msg has authenticated as, if in fact it has authenticated. #f otherwise.

Method: auth-domain:add-path self path
Method: add-path self path

Adds path to self.

Requests under path on self’s server will require authentication (unless overridden by AuthDomain.remove_path or AuthDomain.set_filter).

self

Passed: a <SoupAuthDomain>.

a <SoupAuthDomain>

path

Passed: a string.

the path to add to self

Method: auth-domain:challenge self msg
Method: challenge self msg

Adds a "WWW-Authenticate" or "Proxy-Authenticate" header to msg.

It requests that the client authenticate, and sets msg’s status accordingly.

This is used by Server internally and is probably of no use to anyone else.

self

Passed: a <SoupAuthDomain>.

a <SoupAuthDomain>

msg

Passed: a <SoupServerMessage>.

a <SoupServerMessage>

Method: auth-domain:check-password? self msg username password ⇒ %return
Method: check-password? self msg username password ⇒ %return

Checks if msg authenticates to self via username and password.

This would normally be called from a AuthDomainGenericAuthCallback.

self

Passed: a <SoupAuthDomain>.

a <SoupAuthDomain>

msg

Passed: a <SoupServerMessage>.

a <SoupServerMessage>

username

Passed: a string.

a username

password

Passed: a string.

a password

%return

Returned: a boolean.

whether or not the message is authenticated

Method: auth-domain:covers? self msg ⇒ %return
Method: covers? self msg ⇒ %return

Checks if self requires msg to be authenticated (according to its paths and filter function).

This does not actually look at whether msg is authenticated, merely whether or not it needs to be.

This is used by Server internally and is probably of no use to anyone else.

self

Passed: a <SoupAuthDomain>.

a <SoupAuthDomain>

msg

Passed: a <SoupServerMessage>.

a <SoupServerMessage>

%return

Returned: a boolean.

#t if self requires msg to be authenticated

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

Gets the realm name associated with self.

self

Passed: a <SoupAuthDomain>.

a <SoupAuthDomain>

%return

Returned: a string.

self’s realm

Method: auth-domain:remove-path self path
Method: remove-path self path

Removes path from self.

Requests under path on self’s server will NOT require authentication.

This is not simply an undo-er for AuthDomain.add_path; it can be used to "carve out" a subtree that does not require authentication inside a hierarchy that does. Note also that unlike with AuthDomain.add_path, this cannot be overridden by adding a filter, as filters can only bypass authentication that would otherwise be required, not require it where it would otherwise be unnecessary.

self

Passed: a <SoupAuthDomain>.

a <SoupAuthDomain>

path

Passed: a string.

the path to remove from self

Method: auth-domain:set-filter self filter
Method: set-filter self filter

Adds filter as an authentication filter to self.

The filter gets a chance to bypass authentication for certain requests that would otherwise require it. Eg, it might check the message’s path in some way that is too complicated to do via the other methods, or it might check the message’s method, and allow GETs but not PUTs.

The filter function returns #t if the request should still require authentication, or #f if authentication is unnecessary for this request.

To help prevent security holes, your filter should return #t by default, and only return #f under specifically-tested circumstances, rather than the other way around. Eg, in the example above, where you want to authenticate PUTs but not GETs, you should check if the method is GET and return #f in that case, and then return #t for all other methods (rather than returning #t for PUT and #f for all other methods). This way if it turned out (now or later) that some paths supported additional methods besides GET and PUT, those methods would default to being NOT allowed for unauthenticated users.

You can also set the filter by setting the SoupAuthDomain:filter and [property@AuthDomain:filter-data properties], which can also be used to set the filter at construct time.

self

Passed: a <SoupAuthDomain>.

a <SoupAuthDomain>

filter

Passed: a procedure.

the auth filter for self

See SoupAuthDomainFilter for how it is called.

filter-data

Not passed: guile-gi supplies it.

data to pass to filter

dnotify

Not passed: guile-gi supplies it.

destroy notifier to free filter-data when self is destroyed

See GDestroyNotify for how it is called.

Method: auth-domain:set-generic-auth-callback self auth-callback
Method: set-generic-auth-callback self auth-callback

Sets auth-callback as an authentication-handling callback for self.

Whenever a request comes in to self which cannot be authenticated via a domain-specific auth callback (eg, AuthDomainDigestAuthCallback), the generic auth callback will be invoked. See AuthDomainGenericAuthCallback for information on what the callback should do.

self

Passed: a <SoupAuthDomain>.

a <SoupAuthDomain>

auth-callback

Passed: a procedure.

the auth callback

See SoupAuthDomainGenericAuthCallback for how it is called.

auth-data

Not passed: guile-gi supplies it.

data to pass to auth-callback

dnotify

Not passed: guile-gi supplies it.

destroy notifier to free auth-data when self is destroyed

See GDestroyNotify for how it is called.

Virtual methods

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

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

implementor

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

self

Passed: a <SoupAuthDomain>.

msg

Passed: a <SoupServerMessage>.

header

Passed: a string.

%return

Returned: a string.

Virtual method: auth-domain:do-challenge implementor self msg ⇒ %return

Adds a "WWW-Authenticate" or "Proxy-Authenticate" header to msg.

It requests that the client authenticate, and sets msg’s status accordingly.

This is used by Server internally and is probably of no use to anyone else.

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

implementor

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

self

Passed: a <SoupAuthDomain>.

a <SoupAuthDomain>

msg

Passed: a <SoupServerMessage>.

a <SoupServerMessage>

%return

Returned: a string.

Virtual method: auth-domain:do-check-password implementor self msg username password ⇒ %return

Checks if msg authenticates to self via username and password.

This would normally be called from a AuthDomainGenericAuthCallback.

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

implementor

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

self

Passed: a <SoupAuthDomain>.

a <SoupAuthDomain>

msg

Passed: a <SoupServerMessage>.

a <SoupServerMessage>

username

Passed: a string.

a username

password

Passed: a string.

a password

%return

Returned: a boolean.

whether or not the message is authenticated