atoti_query.security.basic_security module#
- class atoti_query.security.basic_security.BasicSecurity#
Manage basic security on the session.
Note
This requires a config to be passed to
atoti.Session.__init__()
’s authentication parameter.- property credentials: MutableMapping[str, str]#
Mapping from username to password.
Note
At the moment, unlike the rest of the
Security
configuration, these credentials are transient (kept in memory). They are not stored in theuser content storage
and thus will reset when the session stops.Use
individual_roles
to grant roles to the user.Example
>>> session = tt.Session(authentication=tt.BasicAuthenticationConfig()) >>> session.security.basic.credentials {} >>> session.security.basic.credentials["elon"] = "X Æ A-12" >>> # The password can be changed: >>> session.security.basic.credentials["elon"] = "AE A-XII" >>> # But, for security reasons, it cannot be retrieved (accessing it will return a redacted string): >>> session.security.basic.credentials {'elon': '**REDACTED**'} >>> # Prevent user to authenticate through basic authentication: >>> del session.security.basic.credentials["elon"] >>> session.security.basic.credentials {}