Commit ed0f4667 authored by Jakob Moser's avatar Jakob Moser
Browse files

Add connection instructions

parent e5b36c3b
Loading
Loading
Loading
Loading
+12 −6
Original line number Diff line number Diff line
@@ -36,18 +36,14 @@ For the CL account, use:

```python
ldap_server_url = "ldaps://ldap2.cl.uni-heidelberg.de"
server = Server(ldap_server_url, use_ssl=True, tls=TLS_CONFIGURATION)
```

For the Uni ID, use:

```python
ldap_server_url = "ldaps://ad.uni-heidelberg.de"
```

Then, run:

```
server = Server(ldap_server_url, use_ssl=True, tls=TLS_CONFIGURATION)
server = Server(ldap_server_url, use_ssl=True)
```

>>> [!note]
@@ -87,6 +83,16 @@ dn = f"cn={escape_rdn(user)},ou=accounts,dc=cl,dc=uni-heidelberg,dc=de"
dn = f"cn={escape_rdn(user)},ou=fnphi,ou=rzuser,dc=ad,dc=uni-heidelberg,dc=de"
```

## Connect

```python
from ldap3 import Connection

c = Connection(server, user=dn, password=password)
success = c.bind()
print(success)
```

## Further reading

* [`portal/ldap/Directory.py`](https://gitlab.cl.uni-heidelberg.de/fachschaft/portal/-/blob/master/ldap/Directory.py?ref_type=heads): LDAP implementation for another project from which I self-plagiarized many of the instructions here