Skip to content

Commit b11d90b

Browse files
committed
Explain LDAP integration better
1 parent 6f7f80a commit b11d90b

1 file changed

Lines changed: 20 additions & 5 deletions

File tree

docs/backend/05authorization.md

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,24 +100,39 @@ overwrite is not needed.
100100

101101
## OpenLDAP
102102

103+
First thing to do is to depend on `freenit[ldap,sql]`, so change the `pyproject.toml`.
104+
103105
To use OpenLDAP based authentication, you need to tell Freenit where to find user and role, and
104-
how to connect to OpenLDAP server. To do that just for development, you can use the following
105-
snippet.
106+
how to connect to OpenLDAP server. To do that for the whole project, you can use the following
107+
snippet in `base_config.py`.
106108

107109
```py
108-
from .base_config import DevConfig as DevConfigBase
110+
from freenit.base_config import Auth, Mail, BaseConfig as FreenitBaseConfig
109111
from freenit.base_config import LDAP
110112

111-
class DevConfig(DevConfigBase):
113+
class BaseConfig(FreenitBaseConfig):
114+
name = "NAME"
115+
version = "0.0.1"
112116
user = "freenit.models.ldap.user"
113117
role = "freenit.models.ldap.role"
118+
119+
```
120+
121+
Then configure access to LDAP in `local_config.py`.
122+
123+
```py
124+
from .base_config import DevConfig as DevConfigBase
125+
from freenit.base_config import LDAP
126+
127+
class DevConfig(DevConfigBase):
114128
ldap = LDAP(
115129
host="ldap.example.com",
116130
service_pw="mypass",
117131
)
118132
```
119133

120-
The `LDAP` class in Freenit has following arguments with their default arguments:
134+
Do that for `TestConfig` and `ProdConfig` with different credentials. The `LDAP` class in Freenit
135+
has following arguments with their default arguments:
121136

122137

123138
```py

0 commit comments

Comments
 (0)