gws.plugin.auth_provider.file¶
Authentication provider for users stored in a JSON file.
The file contains a list of user records (dicts). Each record must contain
login and password, the password hashed with
gws.lib.password.encode. name is used as the display name. Other
fields, for example roles, email or mfaUid, are passed to
gws.base.auth.user.from_record and become properties of the user.
The provider accepts username and password credentials. If the login
is not found, a dummy hash is checked anyway, so that the response time does
not reveal whether a login exists. The file is read once, at configuration
time.
The command gws auth password asks for a password and prints its hash for
the file.
Example:
auth.providers+ {
type "file"
path "/data/users.json"
}
with /data/users.json:
[
{
"login": "user_1",
"password": "<hash>",
"name": "User 1",
"roles": ["editor"]
}
]
Source code: gws.plugin.auth_provider.file
Package Contents¶
- class gws.plugin.auth_provider.file.Config¶
Bases:
gws.base.auth.provider.ConfigAuthentication against user records in a JSON file.
- path: gws.FilePath¶
Path to the JSON file with user records.
- class gws.plugin.auth_provider.file.Object¶
Bases:
gws.base.auth.provider.ObjectFile authentication provider.
- authenticate(method, credentials)¶
- configure()¶
- get_user(local_uid)¶
- passwd(p: gws.EmptyRequest)¶
Ask for a password and print its hash for the users file.