Authenticate a Datasette instance using headers set by an upstream proxy
Project description
datasette-auth-headers
Authenticate a Datasette instance using headers set by an upstream proxy
This plugin is designed to work when Datasette is being run behind a reverse proxy, such as Caddy, that is performing authentication on behalf of the app and setting headers in the upstream request.
For example, when Caddy and Authentik's proxy provider are used together with a configuration like so:
example.com {
forward_auth * authentik {
// ...
}
reverse_proxy datasette
}
Authentik will set a number of headers in the upstream request, such as X-Authentik-User, to inform us who is authenticated. This plugin uses those headers to create a Datasette actor.
Installation
Install this plugin in the same environment as Datasette.
datasette install datasette-auth-headers
Usage
You must configure this plugin on the global level within Datasette. An example configuration that reads the X-Authentik-User header and uses it as the actor ID is:
{
"plugins": {
"datasette-auth-headers": {
"id-header-name": "X-Authentik-User"
}
}
}
id-header-name is case-insensitive and is the only configuration option at this time.
Development
To set up this plugin locally, first checkout the code. Then create a new virtual environment:
cd datasette-auth-headers
python -m venv venv
source venv/bin/activate
Now install the dependencies and test dependencies:
pip install -e '.[test]'
To run the tests:
python -m 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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file datasette_auth_headers-0.1.0.tar.gz.
File metadata
- Download URL: datasette_auth_headers-0.1.0.tar.gz
- Upload date:
- Size: 7.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fca2f55065bfbceb36b7fee2bbe68d70b0499e8a304f91446e3ca51f224b0702
|
|
| MD5 |
6cc135c39ac3396fe3fdc65e1bcf4fab
|
|
| BLAKE2b-256 |
887745a3ef1ba483a18aa1c3e7fe54dc8f65331119741a4899b397e63c5def8f
|
Provenance
The following attestation bundles were made for datasette_auth_headers-0.1.0.tar.gz:
Publisher:
publish.yml on codemicro/datasette-auth-headers
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
datasette_auth_headers-0.1.0.tar.gz -
Subject digest:
fca2f55065bfbceb36b7fee2bbe68d70b0499e8a304f91446e3ca51f224b0702 - Sigstore transparency entry: 160780076
- Sigstore integration time:
-
Permalink:
codemicro/datasette-auth-headers@dc8d0bdb35c72e0a371ce7ee144bfe79361690e9 -
Branch / Tag:
refs/tags/0.1.0 - Owner: https://github.com/codemicro
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@dc8d0bdb35c72e0a371ce7ee144bfe79361690e9 -
Trigger Event:
release
-
Statement type:
File details
Details for the file datasette_auth_headers-0.1.0-py3-none-any.whl.
File metadata
- Download URL: datasette_auth_headers-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9e171c8b50f0d651ddd298acba994c99084c21157a880a85b572a498a68ec7f0
|
|
| MD5 |
7c55b8e2946263aeb002c288c5b318d0
|
|
| BLAKE2b-256 |
01f3cecb0d769004bf8c15d527b44be1ad63639b3e6de7066c34ca67ccc44552
|
Provenance
The following attestation bundles were made for datasette_auth_headers-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on codemicro/datasette-auth-headers
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
datasette_auth_headers-0.1.0-py3-none-any.whl -
Subject digest:
9e171c8b50f0d651ddd298acba994c99084c21157a880a85b572a498a68ec7f0 - Sigstore transparency entry: 160780078
- Sigstore integration time:
-
Permalink:
codemicro/datasette-auth-headers@dc8d0bdb35c72e0a371ce7ee144bfe79361690e9 -
Branch / Tag:
refs/tags/0.1.0 - Owner: https://github.com/codemicro
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@dc8d0bdb35c72e0a371ce7ee144bfe79361690e9 -
Trigger Event:
release
-
Statement type: