gws.base.auth.system_provider

Built-in provider of the guest and system users.

Source code: gws.base.auth.system_provider

Module Contents

class gws.base.auth.system_provider.Object

Bases: gws.AuthProvider

System authentication provider.

Provides the guest user (roles guest and all) and the system user, which is allowed everything. Neither of them can log in.

type = 'system'

Provider type.

users: dict

The guest and system users, keyed by guest and system.

authenticate(method, credentials)

Authenticate a user.

Parameters:
  • method – The authentication method.

  • credentials – The credentials, for example username and password.

Returns:

The user, or None if the provider does not know the user.

Raises:

AuthenticationError – If the credentials are wrong or match more than one user.

configure()

Configuration hook.

Called when the node is initialized. Raising an exception here aborts the creation of the node.

get_user(local_uid)

Get a user by its local uid.

Parameters:

local_uid – User uid within the provider.

Returns:

The user, or None if not found.

serialize_user(user)

Serialize a user to a string.

Parameters:

user – The user.

Returns:

The serialized user.

unserialize_user(data)

Restore a user serialized by serialize_user.

Parameters:

ser – The serialized user.

Returns:

The user, or None if it cannot be restored.