Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
flask-simpleldap
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
nimrod
flask-simpleldap
Commits
08f14613
Commit
08f14613
authored
5 years ago
by
admiralobvious
Browse files
Options
Downloads
Patches
Plain Diff
merge outstanding PRs
parent
d37a618c
No related branches found
No related tags found
No related merge requests found
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
.travis.yml
+2
-2
2 additions, 2 deletions
.travis.yml
LICENSE
+1
-1
1 addition, 1 deletion
LICENSE
README.md
+13
-1
13 additions, 1 deletion
README.md
flask_simpleldap/__init__.py
+5
-8
5 additions, 8 deletions
flask_simpleldap/__init__.py
run.py
+20
-0
20 additions, 0 deletions
run.py
setup.py
+3
-2
3 additions, 2 deletions
setup.py
with
44 additions
and
14 deletions
.travis.yml
+
2
−
2
View file @
08f14613
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
LICENSE
+
1
−
1
View file @
08f14613
The MIT License (MIT)
The MIT License (MIT)
Copyright (c) 201
7
Alexandre Ferland
Copyright (c) 201
9
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
...
...
This diff is collapsed.
Click to expand it.
README.md
+
13
−
1
View file @
08f14613
...
@@ -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
()
```
```
...
...
This diff is collapsed.
Click to expand it.
flask_simpleldap/__init__.py
+
5
−
8
View file @
08f14613
...
@@ -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
'
]
...
...
This diff is collapsed.
Click to expand it.
run.py
0 → 100644
+
20
−
0
View file @
08f14613
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
()
This diff is collapsed.
Click to expand it.
setup.py
+
3
−
2
View file @
08f14613
...
@@ -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.1
0.1
'
,
'
Flask>=0.1
2.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
'
]
]
)
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment