Flask-HTAuth
Flask-HTAuth provides Flask apps with easy to integrate basic HTTP authentication. The extension supports standard htpasswd files.
Installation
Install with the usual:
pip install flask-htauth
or download source from GitHub:
git clone https://github.com/tomekwojcik/flask-htauth.git cd flask-htauth python setup.py develop
Configuration
Flask-HTAuth uses the following settings:
HTAUTH_HTPASSWD_PATH - path to htpasswd file,
HTAUTH_REALM - authentication realm (defaults to Protected Area)
Example app
from flask import Flask, g
from flask.ext import htauth
import os
HTPASSWD = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'htpasswd')
app = Flask(__name__)
app.config['HTAUTH_HTPASSWD_PATH'] = HTPASSWD
app.config['HTAUTH_REALM'] = 'Top Secret Area'
auth = htauth.HTAuth(app)
@app.route('/')
def app_index():
return 'Hello, World!'
@app.route('/secret')
@htauth.authenticated
def app_secret():
return 'Hello, ' + g.htauth_user + '!'
If the request is missing Authorization header or auth data is invalid the authenticated decorator will return response that will force the user agent to request authentication data from the user.
Features
Basic auth,
Support for MD5, SHA and crypt htpasswd password encrypting.
License
Flask-HTAuth is licensed under MIT License. See LICENSE for more details.
Credits
Flask-HTAuth is developed by BTHLabs. The extension was inspired by django-htauth. Uses MD5 crypt code from this snippet.
Metadata
Release files for Flask-HTAuth 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| Flask-HTAuth-0.1.2.tar.gz | 5.0 kB | Without provenance | Details for Flask-HTAuth-0.1.2.tar.gz |
Release files / Flask-HTAuth-0.1.2.tar.gz
| Download URL | Flask-HTAuth-0.1.2.tar.gz |
|---|---|
| Size | 5.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ba6caadbe44da9c84544c901ca9800cf91152162fefd116b4dc826113d55f4d5
|
|
BLAKE2b-256 checksum How to use checksums |
82df96734a25fe86a2339e756ea67c73e7866706dd7b21499b86f93b08c55b1b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for Flask-HTAuth 0.1.2
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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.