Skip to content

Commit 1a3b0d1

Browse files
committed
add config docs
Signed-off-by: alexferl <[email protected]>
1 parent 9699def commit 1a3b0d1

File tree

1 file changed

+35
-13
lines changed

1 file changed

+35
-13
lines changed

README.md

Lines changed: 35 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# 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+.
53

64
## Quickstart
75
First, install Flask-SimpleLDAP:
@@ -10,8 +8,7 @@ First, install Flask-SimpleLDAP:
108
pip install flask-simpleldap
119
```
1210

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
1512
(2.2.5 or later) and [python-ldap](https://python-ldap.org/).
1613
Please consult the [python-ldap installation instructions](https://www.python-ldap.org/en/latest/installing.html) if you get an error during installation.
1714

@@ -56,12 +53,10 @@ Once you get the basic example working, check out the more complex ones:
5653
and [blueprints](https://flask.palletsprojects.com/en/3.0.x/blueprints/).
5754

5855

59-
OpenLDAP
60-
--------
61-
56+
## OpenLDAP
6257
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
59+
`LDAP_USER_OBJECT_FILTER`.
6560

6661
```python
6762
from flask import Flask, g
@@ -98,6 +93,33 @@ if __name__ == "__main__":
9893
app.run()
9994
```
10095

101-
## Resources
102-
103-
- [PyPI](https://pypi.python.org/pypi/Flask-SimpleLDAP)
96+
## Configuration
97+
| Setting | Description |
98+
|----------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------|
99+
| `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

Comments
 (0)