gws.plugin.auth_method.basic

HTTP Basic authentication method.

The client sends the credentials with every request in an Authorization: Basic ... header. The method decodes the header into username and password credentials, passes them to the authentication providers and opens a transient session for the authenticated user. No cookie is set.

The method is registered as a middleware after auth. If a GET request is denied with status 403, the response is changed to 401 with a WWW-Authenticate header, so that browsers show a login dialog.

Example:

auth.methods+ {
    type "basic"
    realm "My Application"
}

Source code: gws.plugin.auth_method.basic

Package Contents

class gws.plugin.auth_method.basic.Config

Bases: gws.base.auth.method.Config

HTTP basic authentication.

realm: str | None

Authentication realm sent to the client.

class gws.plugin.auth_method.basic.Object

Bases: gws.base.auth.method.Object

HTTP Basic authentication method.

realm: str

Authentication realm sent in the WWW-Authenticate header.

configure()
exit_middleware(req, res)
open_session(req)