Skip to content

Commit b7fc7ec

Browse files
committed
add a local ldap test setup
1 parent e7e7ecf commit b7fc7ec

File tree

2 files changed

+41
-1
lines changed

2 files changed

+41
-1
lines changed

README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,16 @@
2020
## Local HTTPS config
2121

2222
- Generate keys [here](https://www.selfsignedcertificate.com/)
23-
- place in folder `/secrets` named `ssl.cert` and `ssl.key`
23+
- place in folder `/secrets` named `ssl.cert` and `ssl.key`
24+
25+
## Local LDAP test server
26+
27+
- Run `docker compose -f docker-compose.yml -f docker-compose.ldap.yml ` (see [docker docs for multiple-compose-files - merge](https://docs.docker.com/compose/multiple-compose-files/merge/))
28+
- test the login with ldap and have a look at the logs
29+
```sh
30+
curl 'http://localhost:4200/users/login' \
31+
-H 'accept: */*' \
32+
-H 'accept-language: de-DE,de;q=0.9,en-US;q=0.8,en;q=0.7,fr;q=0.6' \
33+
-H 'content-type: application/json' \
34+
--data-raw '{"email":"[email protected]","password":"password"}'
35+
```

docker-compose.ldap.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
version: "3.7"
2+
services:
3+
api:
4+
environment:
5+
LDAP_ENABLED: 'true'
6+
LDAP_TLS_NO_VERIFY: 'true'
7+
LDAP_URL: 'ldaps://ldapmock:636/'
8+
LDAP_BIND_USER: 'cn=admin,dc=ldapmock,dc=local'
9+
LDAP_BIND_PASSWORD: 'adminpass'
10+
LDAP_SEARCH_DN: 'ou=people,dc=ldapmock,dc=local'
11+
LDAP_USERS_SEARCH_FILTER: '(&(objectClass=person)(mail={{email}}))'
12+
LDAP_ATTRIBUTE_LAST_NAME: 'sn'
13+
LDAP_ATTRIBUTE_FIRST_NAME: 'givenName'
14+
LDAP_ATTRIBUTE_MAIL: 'mail'
15+
depends_on:
16+
postgres:
17+
condition: service_healthy
18+
ldapmock:
19+
condition: service_started
20+
ldapmock:
21+
container_name: ldapmock
22+
# See https://github.com/docker-ThoTeam/slapd-server-mock/tree/main
23+
# Default users in LDAP: https://github.com/docker-ThoTeam/slapd-server-mock/blob/main/bootstrap/data.ldif.TEMPLATE
24+
# e.g.: [email protected]:password
25+
image: thoteam/slapd-server-mock:latest
26+
restart: always
27+
ports:
28+
- "636:636"

0 commit comments

Comments
 (0)