Canadaalexferl/flask-simpleldap
LDAP authentication extension for the Flask web framework
🔐 Flask-SimpleLDAP: Xác thực LDAP nhanh cho Flask
Một extension Python nhẹ, mang LDAP authentication trực tiếp vào ứng dụng Flask chỉ với vài dòng cấu hình.
Flask-SimpleLDAP là một extension cho Flask hỗ trợ xác thực người dùng qua máy chủ LDAP. Dự án tương thích với Python 3.10+, dựa trên thư viện python-ldap, và cung cấp các decorator như @ldap.basic_auth_required, @ldap.login_required, @ldap.group_required() để bảo vệ route một cách đơn giản.
✨ Điểm nổi bật
- Cài đặt nhanh:
pip install flask-simpleldap, tự động cài Flask và python-ldap. - Xác thực HTTP Basic: Dùng
@ldap.basic_auth_requiredđể bảo vệ route bằng popup đăng nhập trình duyệt. - Đăng nhập form/cookie: Hỗ trợ
@ldap.login_requiredthay thế Basic Auth bằng form và cookie. - Phân quyền theo nhóm: Dùng
@ldap.group_required()để giới hạn truy cập theo nhóm LDAP. - Hỗ trợ OpenLDAP: Cấu hình riêng cho schema và bộ lọc đối tượng nhóm của OpenLDAP.
- Tích hợp với Blueprint và Application Factory: Ví dụ đi kèm sẵn theo mẫu ứng dụng Flask hiện đại.
- Cấu hình linh hoạt: Bảng cấu hình chi tiết với hơn 20 tùy chọn như host, port, schema, timeout, TLS/SSL.
- Lấy thông tin người dùng: Truy cập tên người dùng qua
g.ldap_usernamesau khi xác thực thành công.
💡 Vì sao đáng chú ý
Không cần viết lại logic kết nối LDAP hay quản lý session — Flask-SimpleLDAP cung cấp sẵn các decorator và lớp LDAP để tích hợp nhanh. Đặc biệt phù hợp với dự án nội bộ hoặc ứng dụng doanh nghiệp dùng LDAP/OpenLDAP để quản lý người dùng và nhóm. Các ví dụ thực tế (basic_auth, groups, blueprints) giúp người dùng tiếp cận nhanh từ cơ bản đến nâng cao.
#Flask #LDAP #Authentication #Python #OpenSource #TiniX
Similar Projects
Discover other similar projects and AI models.
:octocat: 分享 GitHub 上有趣、入门级的开源项目。Share interesting, entry-level open source projects on GitHub.
The 30 Days of Python programming challenge is a step-by-step guide to learn the Python programming language in 30 days. This challenge may take more than 100 days. Follow your own pace. These videos may help too: https://www.youtube.com/channel/UC7PNRuno1rzYPb1xLa4yktw
Learn how to design large-scale systems. Prep for the system design interview. Includes Anki flashcards.
The definitive list that answers "I want to do X in Python, which tool should I use?"
AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.