gws.base.auth.manager

Authorization and session manager.

Source code: gws.base.auth.manager

Module Contents

class gws.base.auth.manager.Config(*args, **kwargs)

Authentication and authorization options

methods: list[gws.ext.config.authMethod] | None

Authorization methods.

mfa: list[gws.ext.config.authMultiFactorAdapter] | None

Authorization providers.

providers: list[gws.ext.config.authProvider] | None

Authorization providers.

session: gws.ext.config.authSessionManager | None

Session options.

throttle: Config.throttle | None

Authentication throttle options. (added in 8.4)

class gws.base.auth.manager.Object

Authorization manager.

add_method(method)

Register an authentication Method.

add_multi_factor_adapter(adapter)

Register a Multi-Factor Adapter.

add_provider(provider)

Register an authentication Provider.

authenticate(method, credentials, req)

Authenticate a user.

can_use_method(req, meth)

Check if a Method may be used in the context of a Requester.

configure()

Configuration hook.

create_transient_session(method, user, data=None)

Create a Session which only lives for the duration of the request. (added in 8.4)

Parameters:
  • method – Auth Method that creates the Session.

  • user – ‘User’ for which the Session is created.

  • data – Session data.

Returns:

A new Session.

enter_middleware(req: gws.WebRequester)

Begin middleware processing.

Parameters:

req – Requester object.

Returns:

A Responder object or None.

exit_middleware(req: gws.WebRequester, res: gws.WebResponder)

Finish middleware processing.

Parameters:
  • req – Requester object.

  • res – Current responder object.

get_method(uid=None, ext_type=None)

Get an authentication Method by its uid.

get_multi_factor_adapter(uid=None, ext_type=None)

Get a Multi-Factor Adapter by its uid.

get_provider(uid)

Get an authentication Provider by its uid.

get_user(user_uid)

Get a User by its global uid.

is_public_object(obj, *context)

Check if an object is public.

serialize_user(user)

Return a string representation of a User.

unserialize_user(data)

Restore a User object from a serialized representation.