gws.base.auth.manager

Authorization and session manager.

Source code: gws.base.auth.manager

Module Contents

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

Bases: gws.Config

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

class gws.base.auth.manager.Object

Bases: gws.AuthManager

Authorization manager.

authenticate(method, credentials)

Authenticate a user.

Parameters:
  • method – Authentication method.

  • credentials – Credentials object.

Returns:

An authenticated User or None if authentication failed.

configure()

Configuration hook.

enter_middleware(req)

Begin middleware processing.

Parameters:

req – Requester object.

Returns:

A Responder object or None.

exit_middleware(req, res)

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.

Parameters:

uid – Uid.

Returns:

A Method or None.

get_mf_adapter(uid=None, ext_type=None)

Get an authentication Provider by its uid.

Parameters:

uid – Uid.

Returns:

A Provider or None.

get_provider(uid=None)

Get an authentication Provider by its uid.

Parameters:

uid – Uid.

Returns:

A Provider or None.

get_user(user_uid)

Get a User by its global uid.

Parameters:

user_uid – Global user uid.

Returns:

A User or None.

serialize_user(user)

Return a string representation of a User.

Parameters:

user – A User object.

Returns:

A json string.

unserialize_user(data)

Restore a User object from a serialized representation.

Parameters:

ser – A json string.

Returns:

A User object.