Skip to content
Snippets Groups Projects
Commit ebdfac12 authored by nimrod's avatar nimrod
Browse files

Replace flask-simpleldap with flask-ldap-auth.

Simpler binding (just specify the URI), so no patch required.
parent 9275119d
No related branches found
No related tags found
No related merge requests found
...@@ -3,7 +3,6 @@ FROM registry.hub.docker.com/library/python:3.9-slim-buster ...@@ -3,7 +3,6 @@ FROM registry.hub.docker.com/library/python:3.9-slim-buster
RUN apt-get update && \ RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
build-essential \ build-essential \
git \
libldap2-dev \ libldap2-dev \
libsasl2-dev \ libsasl2-dev \
&& \ && \
......
"""LDAP authentication webserver to use with Nginx' auth_request.""" """LDAP authentication webserver to use with Nginx' auth_request."""
# pylint: disable=import-error # pylint: disable=import-error
from flask import Flask import os
from flask_simpleldap import LDAP from flask import Flask, token
from flask_ldap_auth import login_required
app = Flask(__name__) app = Flask(__name__)
ldap = LDAP(app) app.config["SECRET_KEY"] = os.getenv("SECRET_KEY", os.urandom(16))
app.config["LDAP_AUTH_SERVER"] = os.getenv("LDAP_AUTH_SERVER", "ldapi:///")
app.config["LDAP_TOP_DN"] = os.getenv("LDAP_TOP_DN")
app.register_blueprint(token, url_prefix="/auth")
@app.route("/ping") @app.route("/ping")
...@@ -20,7 +24,7 @@ def index(): ...@@ -20,7 +24,7 @@ def index():
@app.route("/login") @app.route("/login")
@ldap.basic_auth_required @login_required
def login(): def login():
return "OK" return "OK"
......
flask flask
#flask-simpleldap flask-ldap-auth
git+https://github.com/adarnimrod/flask-simpleldap.git@ldapi-support#egg=flask-simpleldap
gunicorn gunicorn
python-ldap python-ldap
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment