atoti_query.security.basic_security.BasicSecurity.credentials#

property BasicSecurity.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 the user 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
{}