Authentication based on the ENVAUTH environment variable
Project description
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
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
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
envauth-1.0.1.tar.gz
(3.6 kB
view details)
File details
Details for the file envauth-1.0.1.tar.gz
.
File metadata
- Download URL: envauth-1.0.1.tar.gz
- Upload date:
- Size: 3.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 683729141ab25f1bebbcbaced6e74eb8329550997cbf710475eb19d0ceaf0543 |
|
MD5 | b8313415cf660c94438c264f0d514d34 |
|
BLAKE2b-256 | fae34f52bbbe630089fd54d13d52c811cfcd98b883d3310f1938b19c4ba21389 |