Skip to content
Snippets Groups Projects
Commit 08f14613 authored by admiralobvious's avatar admiralobvious
Browse files

merge outstanding PRs

parent d37a618c
No related branches found
No related tags found
No related merge requests found
...@@ -3,12 +3,12 @@ sudo: required ...@@ -3,12 +3,12 @@ sudo: required
dist: xenial dist: xenial
python: python:
- "2.7" - "2.7"
- "3.4"
- "3.5" - "3.5"
- "3.6" - "3.6"
- "3.7" - "3.7"
env: env:
- FLASK=1.0.2 - FLASK=1.1.1
- FLASK=1.0.4
- FLASK=0.12.4 - FLASK=0.12.4
install: install:
- pip install Flask==$FLASK - pip install Flask==$FLASK
......
The MIT License (MIT) The MIT License (MIT)
Copyright (c) 2017 Alexandre Ferland Copyright (c) 2019 Alexandre Ferland
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
......
...@@ -14,7 +14,7 @@ First, install Flask-SimpleLDAP: ...@@ -14,7 +14,7 @@ First, install Flask-SimpleLDAP:
Flask-SimpleLDAP depends, and will install for you, recent versions of Flask Flask-SimpleLDAP depends, and will install for you, recent versions of Flask
(0.10.1 or later) and [pyldap](https://github.com/pyldap/pyldap). Flask-SimpleLDAP is compatible (0.10.1 or later) and [pyldap](https://github.com/pyldap/pyldap). Flask-SimpleLDAP is compatible
with and tested on Python 2.7, 3.4, 3.5 and 3.6. with and tested on Python 2.7, 3.5, 3.6 and 3.7.
Next, add a ``LDAP`` instance to your code and at least the three Next, add a ``LDAP`` instance to your code and at least the three
required configuration options: required configuration options:
...@@ -30,10 +30,16 @@ app.config['LDAP_PASSWORD'] = 'password' ...@@ -30,10 +30,16 @@ app.config['LDAP_PASSWORD'] = 'password'
ldap = LDAP(app) ldap = LDAP(app)
@app.route('/ldap') @app.route('/ldap')
@ldap.login_required @ldap.login_required
def ldap_protected(): def ldap_protected():
return 'Success!' return 'Success!'
if __name__ == '__main__':
app.run()
``` ```
You can take a look at [examples/groups](examples/groups) for a more complete You can take a look at [examples/groups](examples/groups) for a more complete
...@@ -78,10 +84,16 @@ app.config['LDAP_GROUP_MEMBER_FILTER_FIELD'] = "cn" ...@@ -78,10 +84,16 @@ app.config['LDAP_GROUP_MEMBER_FILTER_FIELD'] = "cn"
ldap = LDAP(app) ldap = LDAP(app)
@app.route('/ldap') @app.route('/ldap')
@ldap.login_required @ldap.login_required
def ldap_protected(): def ldap_protected():
return 'Success!' return 'Success!'
if __name__ == '__main__':
app.run()
``` ```
......
...@@ -75,9 +75,6 @@ class LDAP(object): ...@@ -75,9 +75,6 @@ class LDAP(object):
if app.config['LDAP_{0}'.format(option)] is None: if app.config['LDAP_{0}'.format(option)] is None:
raise LDAPException('LDAP_{0} cannot be None!'.format(option)) raise LDAPException('LDAP_{0} cannot be None!'.format(option))
# Bind LDAP to app
app.ldap = self
@staticmethod @staticmethod
def _set_custom_options(conn): def _set_custom_options(conn):
options = current_app.config['LDAP_CUSTOM_OPTIONS'] options = current_app.config['LDAP_CUSTOM_OPTIONS']
......
run.py 0 → 100644
from flask import Flask
from flask_simpleldap import LDAP
app = Flask(__name__)
app.config['LDAP_BASE_DN'] = 'OU=users,dc=example,dc=org'
app.config['LDAP_USERNAME'] = 'CN=user,OU=Users,DC=example,DC=org'
app.config['LDAP_PASSWORD'] = 'password'
ldap = LDAP(app)
@app.route('/ldap')
@ldap.login_required
def ldap_protected():
return 'Success!'
if __name__ == '__main__':
app.run()
...@@ -9,7 +9,7 @@ from setuptools import setup ...@@ -9,7 +9,7 @@ from setuptools import setup
setup( setup(
name='Flask-SimpleLDAP', name='Flask-SimpleLDAP',
version='1.2.0', version='1.3.0',
url='https://github.com/admiralobvious/flask-simpleldap', url='https://github.com/admiralobvious/flask-simpleldap',
license='MIT', license='MIT',
author='Alexandre Ferland', author='Alexandre Ferland',
...@@ -21,7 +21,7 @@ setup( ...@@ -21,7 +21,7 @@ setup(
include_package_data=True, include_package_data=True,
platforms='any', platforms='any',
install_requires=[ install_requires=[
'Flask>=0.10.1', 'Flask>=0.12.4',
'python-ldap' 'python-ldap'
], ],
classifiers=[ classifiers=[
...@@ -33,6 +33,7 @@ setup( ...@@ -33,6 +33,7 @@ setup(
'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Topic :: Software Development :: Libraries :: Python Modules' 'Topic :: Software Development :: Libraries :: Python Modules'
] ]
) )
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment