Skip to main content

datasette-auth-headers

PyPI Changelog Tests License

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

Release files for datasette-auth-headers 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for datasette-auth-headers 0.1.0
File Size Uploaded
datasette_auth_headers-0.1.0.tar.gz 7.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for datasette-auth-headers 0.1.0
File Interpreter ABI Platform
datasette_auth_headers-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 14.3 kB

Release files / datasette_auth_headers-0.1.0.tar.gz

Download URL datasette_auth_headers-0.1.0.tar.gz
Size 7.1 kB
Tags Source
SHA-256 checksum
How to use checksums
fca2f55065bfbceb36b7fee2bbe68d70b0499e8a304f91446e3ca51f224b0702
BLAKE2b-256 checksum
How to use checksums
887745a3ef1ba483a18aa1c3e7fe54dc8f65331119741a4899b397e63c5def8f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.0.1 CPython/3.12.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 8, 2025.

Transparency log

Release files / datasette_auth_headers-0.1.0-py3-none-any.whl

Download URL datasette_auth_headers-0.1.0-py3-none-any.whl
Size 7.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9e171c8b50f0d651ddd298acba994c99084c21157a880a85b572a498a68ec7f0
BLAKE2b-256 checksum
How to use checksums
01f3cecb0d769004bf8c15d527b44be1ad63639b3e6de7066c34ca67ccc44552
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.0.1 CPython/3.12.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 8, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page