You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+35-13Lines changed: 35 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,5 @@
1
1
# Flask-SimpleLDAP
2
-
Flask-SimpleLDAP provides LDAP authentication for Flask.
3
-
4
-
Flask-SimpleLDAP is compatible with and tested on Python 3.8+.
2
+
Flask-SimpleLDAP provides LDAP authentication for Flask and is compatible with and tested on Python 3.8+.
5
3
6
4
## Quickstart
7
5
First, install Flask-SimpleLDAP:
@@ -10,8 +8,7 @@ First, install Flask-SimpleLDAP:
10
8
pip install flask-simpleldap
11
9
```
12
10
13
-
14
-
Flask-SimpleLDAP depends, and will install for you, recent versions of Flask
11
+
Flask-SimpleLDAP depends, and will install for you, a recent version of Flask
15
12
(2.2.5 or later) and [python-ldap](https://python-ldap.org/).
16
13
Please consult the [python-ldap installation instructions](https://www.python-ldap.org/en/latest/installing.html) if you get an error during installation.
17
14
@@ -56,12 +53,10 @@ Once you get the basic example working, check out the more complex ones:
56
53
and [blueprints](https://flask.palletsprojects.com/en/3.0.x/blueprints/).
57
54
58
55
59
-
OpenLDAP
60
-
--------
61
-
56
+
## OpenLDAP
62
57
Add the `LDAP` instance to your code and depending on your OpenLDAP
63
-
configuration, add the following at least LDAP_USER_OBJECT_FILTER and
64
-
LDAP_USER_OBJECT_FILTER.
58
+
configuration, add the following at least `LDAP_USER_OBJECT_FILTER` and
|`LDAP_HOST`| The host name or IP address of your LDAP server. Default: `"localhost"`. |
100
+
|`LDAP_PORT`| The port number of your LDAP server. Default: `389`. |
101
+
|`LDAP_SCHEMA`| The LDAP schema to use between `"ldap"`, `"ldapi"` and `"ldaps"`. Default: `"ldap"`. |
102
+
|`LDAP_SOCKET_PATH`| If `LDAP_SCHEMA` is set to `"ldapi"`, the path to the Unix socket path. Default: `"/"`. |
103
+
|`LDAP_USERNAME`|**Required**: The username used to bind. |
104
+
|`LDAP_PASSWORD`|**Required**: The password used to bind. |
105
+
|`LDAP_TIMEOUT`| How long (seconds) a connection can take to be opened before timing out. Default: `10`. |
106
+
|`LDAP_LOGIN_VIEW`| Views decorated with `.login_required()` or`.group_required()` will redirect unauthenticated requests to this view. Default: `"login"`. |
107
+
|`LDAP_REALM_NAME`| Views decorated with `.basic_auth_required()` will use this as the "realm" part of HTTP Basic Authentication when responding to unauthenticated requests. |
108
+
|`LDAP_OPENLDAP`| Set to `True` if your server is running OpenLDAP. Default: `False`. |
109
+
|`LDAP_USE_SSL`| Set to `True` if your server uses SSL. Default: `False`. |
110
+
|`LDAP_USE_TLS`| Set to `True` if your server uses TLS. Default: `False`. |
111
+
|`LDAP_REQUIRE_CERT`| Set to `True` if your server requires a certificate. Default: `False`. |
112
+
|`LDAP_CERT_PATH`| Path to the certificate if `LDAP_REQUIRE_CERT` is `True`. |
113
+
|`LDAP_CUSTOM_OPTIONS`|`dict` of ldap options you want to set in this format: `{option: value}`. Default: `None`. |
114
+
|`LDAP_BASE_DN`|**Required**: The distinguished name to use as the search base. |
115
+
|`LDAP_OBJECTS_DN`| The field to use as the objects' distinguished name. Default: `"distinguishedName"`. |
116
+
|`LDAP_USER_FIELDS`|`list` of fields to return when searching for a user's object details. Default: `[]` (all). |
117
+
|`LDAP_USER_GROUPS_FIELD`| The field to return when searching for a user's groups. Default: `"memberOf"`. |
118
+
|`LDAP_USER_OBJECT_FILTER`| The filter to use when searching for a user object. Default: `"(&(objectclass=Person)(userPrincipalName=%s))"`|
119
+
|`LDAP_USERS_OBJECT_FILTER`| The filter to use when searching for users objects. Default: `"objectclass=Person"`|
120
+
|`LDAP_GROUP_FIELDS`|`list` of fields to return when searching for a group's object details. Default: `[]` (all). |
121
+
|`LDAP_GROUP_MEMBER_FILTER`| The group member filter to use when using OpenLDAP. Default: `"*"`. |
122
+
|`LDAP_GROUP_MEMBER_FILTER_FIELD`| The group member filter field to use when using OpenLDAP. Default: `"*"`. |
123
+
|`LDAP_GROUP_MEMBERS_FIELD`| The field to return when searching for a group's members. Default: `"member"`. |
124
+
|`LDAP_GROUP_OBJECT_FILTER`| The filter to use when searching for a group object. Default: `"(&(objectclass=Group)(userPrincipalName=%s))"`. |
125
+
|`LDAP_GROUPS_OBJECT_FILTER`| The filter to use when searching for groups objects. Default: `"objectclass=Group"`. |
0 commit comments