chore: apply suggestions from code review
Co-authored-by: zmstone <zmstone@gmail.com>
This commit is contained in:
parent
cbaa0b0be0
commit
d9086139eb
|
@ -19,22 +19,24 @@ bootstrap_file.label:
|
||||||
"""Bootstrap File Path"""
|
"""Bootstrap File Path"""
|
||||||
|
|
||||||
bootstrap_type.desc:
|
bootstrap_type.desc:
|
||||||
"""- **`plain`**:
|
"""Specify which type of content the bootstrap file has.
|
||||||
- Format: `{user_id},{password},{is_superuser}`
|
|
||||||
- `user_id`: Can be `clientid` or `username`, based on `user_id_type`.
|
|
||||||
- `password`: User's plaintext password.
|
|
||||||
- `is_superuser`: Boolean, user's administrative status.
|
|
||||||
|
|
||||||
- **`hash`**:
|
- **`plain`**:
|
||||||
- Format: `{user_id},{password_hash},{salt},{is_superuser}`
|
- Expected data fields: `user_id`, `password`, `is_superuser`
|
||||||
- Definitions similar to `plain` type, with `password_hash` and `salt` added for security.
|
- `user_id`: Can be Client ID or username, depending on built-in database authentication's `user_id_type` config.
|
||||||
|
- `password`: User's plaintext password.
|
||||||
|
- `is_superuser`: Boolean, user's administrative status.
|
||||||
|
|
||||||
All file format support is the same as `authentication/password_based:built_in_database/import_users` API.
|
- **`hash`**:
|
||||||
Json file plain format example:`[{"user_id": "my_user","password": "s3cr3tp@ssw0rd","is_superuser": true}]`.
|
- Expected data fields: `user_id`,`password_hash`,`salt`,`is_superuser`
|
||||||
CSV file hash format example :`user_id,password_hash,salt,is_superuser\nmy_user,b6c743545a7817ae8c8f624371d5f5f0373234bb0ff36b8ffbf19bce0e06ab75,de1024f462fb83910fd13151bd4bd235,true`
|
- Definitions similar to `plain` type, with `password_hash` and `salt` added for security.
|
||||||
|
|
||||||
Formula for `password_hash`:
|
The content can be either in CSV, or JSON format.
|
||||||
If configured as `password_hash_algorithm {name = sha256, salt_position = suffix}`,
|
|
||||||
the Python code to calculate the `password_hash` is `hashlib.sha256(password + salt).hexdigest()`."""
|
Here is a CSV example: `user_id,password_hash,salt,is_superuser\nmy_user,b6c743545a7817ae8c8f624371d5f5f0373234bb0ff36b8ffbf19bce0e06ab75,de1024f462fb83910fd13151bd4bd235,true`
|
||||||
|
|
||||||
|
And JSON content should be decoded into an array of objects, for example: `[{"user_id": "my_user","password": "s3cr3tp@ssw0rd","is_superuser": true}]`.
|
||||||
|
|
||||||
|
The hash string for password_hash depends on how password_hash_algorithm is configured for the built-in database authentication mechanism. For example, if it's configured as `password_hash_algorithm {name = sha256, salt_position = suffix}`, then the salt is appended to the password before hashed. Here is the equivalent Python expression: `hashlib.sha256(password + salt).hexdigest()`."""
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue