Skip to main content

Super simple authentication middleware for when you quickly need to password protect something and don’t have the time to implement rigorous authentication. Supports Flask, bottle, Django and generic WSGI servers out of the box.

$ENVAUTH

envauth looks for a JSON object in the ENVAUTH environment variable. The keys are the usernames and the value contains the password for the user.

{"username": "password", "anotheruser": "pass1234"}

Heroku Example

envauth is especially useful if you happen to be running your application on a PAAS!

$ heroku config:set ENVAUTH='{"username": "password", "anotheruser": "pass1234"}'
Setting config vars and restarting application... done, v2

Examples

pypi

Flask

import envauth

@app.route('/secret-page')
@envauth.flask.requires_auth(realm='You shall not pass!')
def secret_page():
    return render_template('secret_page.html')

Bottle

import envauth

@app.route('/secret-page')
@envauth.bottle.requires_auth(realm='You shall not pass!')
def secret_page():
    return template('secret_page.html')

Django

MIDDLEWARE_CLASSES += ('envauth.django',)

WSGI

import envauth

application = envauth.wsgi(application, realm='You shall not pass!')

Installation

Install envauth with pip:

$ pip install envauth

Metadata

Release files for envauth 1.0.1

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

Source distribution (sdist)

Source distribution for envauth 1.0.1
File Size Uploaded Provenance
envauth-1.0.1.tar.gz 3.6 kB Without provenance Details

Release files / envauth-1.0.1.tar.gz

Download URL envauth-1.0.1.tar.gz
Size 3.6 kB
Tags Source
SHA-256 checksum
How to use checksums
683729141ab25f1bebbcbaced6e74eb8329550997cbf710475eb19d0ceaf0543
BLAKE2b-256 checksum
How to use checksums
fae34f52bbbe630089fd54d13d52c811cfcd98b883d3310f1938b19c4ba21389
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for envauth 1.0.1

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

1.0.1 This release

1 release file No provenance

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