atoti.security.basic_authentication_security.BasicAuthenticationSecurity.credentials#
- property BasicAuthenticationSecurity.credentials: MutableMapping[str, str]#
Mapping from username to password.
Note
At the moment, unlike the rest of the
Security
config, 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.start(tt.SessionConfig(security=tt.SecurityConfig())) >>> session.security.basic_authentication.credentials {} >>> session.security.basic_authentication.credentials["elon"] = "X Æ A-12" >>> # The password can be changed: >>> session.security.basic_authentication.credentials["elon"] = "AE A-XII" >>> # But, for security reasons, it cannot be retrieved (accessing it will return a redacted string): >>> session.security.basic_authentication.credentials {'elon': '**REDACTED**'} >>> # Prevent user to authenticate through basic authentication: >>> del session.security.basic_authentication.credentials["elon"] >>> session.security.basic_authentication.credentials {}