class atoti_plus.BasicSecurity#

Manage basic authentication on the session.


This requires a BasicAuthenticationConfig to be passed to Session()’s authentication parameter.

create_user(username, *, password=None, roles=())#

Add a user able to authenticate against the session using Basic Authentication.

Users without the role ROLE_USER will not have access to the application.

  • username (str) – The name of the user.

  • password (Optional[str]) – The password of the user, can be changed at any time.

  • roles (Iterable[str]) – Roles of the user, can be changed at any time.

Return type



>>> from atoti_plus import UserServiceClient
>>> session = tt.Session(authentication=tt.BasicAuthenticationConfig())
>>> client = UserServiceClient.from_session(session)
>>> list(client.basic.users)
>>> elon = client.basic.create_user("elon", password="X Æ A-12")
>>> list(client.basic.users)
>>> # The special ROLE_USER role is automatically added
>>> list(elon.roles)
>>> # Change the password
>>> elon.password = "AE A-XII"
>>> # Revoke access
>>> del client.basic.users["elon"]
>>> list(client.basic.users)
property users: BasicUsers#
class atoti_plus.BasicUsers#

Manage basic authentication users.