Skip to main content

Flask extension that provides an easy way to protect certain views of an application with LDAP and HTTP basic access authentication.

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Flask-BasicAuth-LDAP-0.0.0a1.dev2.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file Flask-BasicAuth-LDAP-0.0.0a1.dev2.tar.gz.

File metadata

  • Download URL: Flask-BasicAuth-LDAP-0.0.0a1.dev2.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for Flask-BasicAuth-LDAP-0.0.0a1.dev2.tar.gz
Algorithm Hash digest
SHA256 def87b2e6356084551722e9fd0bf1d886e681c663352a0008c36e519d7d14dee
MD5 6e0fd1142975ba287ba0d983dff53a88
BLAKE2b-256 dcce001c3c59a98dc82fc617d0c6edaff22ed773505ca0745f09b40166b1257c

See more details on using hashes here.

File details

Details for the file Flask_BasicAuth_LDAP-0.0.0a1.dev2-py3-none-any.whl.

File metadata

  • Download URL: Flask_BasicAuth_LDAP-0.0.0a1.dev2-py3-none-any.whl
  • Upload date:
  • Size: 3.0 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for Flask_BasicAuth_LDAP-0.0.0a1.dev2-py3-none-any.whl
Algorithm Hash digest
SHA256 fa3f5b644d1a8743ab2791cef2bbd753c26480382f3b75e5f2c940319663640d
MD5 cb6f91dc82162868ae0ae996f148f5c1
BLAKE2b-256 198bd603b4881345daf4e720f7521605dbf0bf2e347c16ad4853c542c522b2f3

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page