Datasette plugin for authenticating access using passwords
Project description
datasette-auth-passwords
Datasette plugin for authenticating access using passwords
Installation
Install this plugin in the same environment as Datasette.
$ pip install datasette-auth-passwords
Usage
This plugin works based on a list of username/password accounts that are hard-coded into the plugin configuration.
First, you'll need to create a password hash. You can do this using the tool located at /-/password-tool
when the plugin is installed.
Now add the following to your metadata.json
:
{
"plugins": {
"datasette-auth-passwords": {
"accounts": {
"your_username": {
"password_hash": {
"$env": "PASSWORD_HASH_1"
},
"actor": {
"id": "your_username"
}
}
}
}
}
}
The password hash can now be specified in an environment variable when you run Datasette. You can do that like so:
PASSWORD_HASH_1="pbkdf2_sha256$..." \
datasette -m metadata.json
Or by using the --plugin-secret
option to datasette publish
, see Secret configuration values.
You will now be able to log in to your instance using the form at /-/login
with your_username
as the username and the password that you used to create your hash as the password.
You can include as many accounts as you like in the configuration, each with different usernames.
The "actor"
block in each one is the actor that will be authenticated - see Actors in the Datasette documentation for details.
Development
To set up this plugin locally, first checkout the code. Then create a new virtual environment:
cd datasette-auth-passwords
python3 -mvenv venv
source venv/bin/activate
Or if you are using pipenv
:
pipenv shell
Now install the dependencies and tests:
pip install -e '.[test]'
To run the tests:
pytest
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for datasette-auth-passwords-0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7e20f9095180e9752c9f9255a7b30575b5f2e00b58d913e664155f79273568f2 |
|
MD5 | 3a33c6e64a8fa067f004a90a8f555eaa |
|
BLAKE2b-256 | 8ac88235f455e94b8e6eceb3b192f99b3350b3324640a191cb187f82d1029389 |
Hashes for datasette_auth_passwords-0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 12816b692ceb5a1b0d4b2aef707749713cfc754301437197ad9864de0e35f689 |
|
MD5 | 91bed2c9ebcedecb236967e309e5b734 |
|
BLAKE2b-256 | ba531fd0907367ad3979c4afd41fa9e98b5807b7be0689b1639f3ea37a213be9 |