This release is a pre-release and may not be stable for production use.
Flask-BasicAuth-LDAP
Flask-BasicAuth-LDAP is a Flask extension that provides an easy way to protect
certain views of an application with LDAP_ and HTTP basic access authentication_
.. _LDAP: https://en.wikipedia.org/wiki/Lightweight_Directory_Access_Protocol .. _basic access authentication: https://en.wikipedia.org/wiki/Basic_access_authentication
Install
::
pip install flask-basicauth-ldap
Quickstart
::
from flask import Flask, jsonify
from flask_basicauth_ldap import LDAPBasicAuth
app = Flask(__name__)
auth = LDAPBasicAuth(app)
app.config['LDAP_HOST'] = 'ldap://test_host'
app.config['LDAP_PORT'] = 'test_port'
app.config['LDAP_DOMAIN'] = 'test_domain'
@app.route('/secret', methods=['GET'])
@auth.required
def secret_view():
return jsonify({'status': 'secret'})
If you want to change a response on the unauthorized access, just use
unauthorizedhandler to register function that should return Response object
::
@auth.unauthorizedhandler def custom_unathorized_view(): return jsonify({'message': 'Athorize first'}), 401
Metadata
Release files for Flask-BasicAuth-LDAP 0.0.0a1.dev2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| Flask-BasicAuth-LDAP-0.0.0a1.dev2.tar.gz | 3.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| Flask_BasicAuth_LDAP-0.0.0a1.dev2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 6.4 kB
Release files / Flask-BasicAuth-LDAP-0.0.0a1.dev2.tar.gz
| Download URL | Flask-BasicAuth-LDAP-0.0.0a1.dev2.tar.gz |
|---|---|
| Size | 3.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
def87b2e6356084551722e9fd0bf1d886e681c663352a0008c36e519d7d14dee
|
|
BLAKE2b-256 checksum How to use checksums |
dcce001c3c59a98dc82fc617d0c6edaff22ed773505ca0745f09b40166b1257c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.1.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.3
|
Release files / Flask_BasicAuth_LDAP-0.0.0a1.dev2-py3-none-any.whl
| Download URL | Flask_BasicAuth_LDAP-0.0.0a1.dev2-py3-none-any.whl |
|---|---|
| Size | 3.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fa3f5b644d1a8743ab2791cef2bbd753c26480382f3b75e5f2c940319663640d
|
|
BLAKE2b-256 checksum How to use checksums |
198bd603b4881345daf4e720f7521605dbf0bf2e347c16ad4853c542c522b2f3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.1.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.3
|