https://github.com/lazhari/ldap-node
Search users on OpenLDAP server using ldapjs and express.
https://github.com/lazhari/ldap-node
docker docker-compose express ldap ldapjs nodejs
Last synced: 3 months ago
JSON representation
Search users on OpenLDAP server using ldapjs and express.
- Host: GitHub
- URL: https://github.com/lazhari/ldap-node
- Owner: Lazhari
- Created: 2019-06-28T15:04:45.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2022-12-10T20:59:38.000Z (over 3 years ago)
- Last Synced: 2025-01-21T21:09:33.203Z (over 1 year ago)
- Topics: docker, docker-compose, express, ldap, ldapjs, nodejs
- Language: JavaScript
- Size: 639 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- Security: SECURITY.md
Awesome Lists containing this project
README
# LDAP Node.js
> Search users on OpenLDAP server using ldapjs and express.
Working with LDAP on dev environment isn't an easy thing, and especially when it comes to configuring an OpenLDAP only for development. So this project contains a simple implementation for users search feature from LDAP, and a docker environment for development based only on docker-compose, so there's no docker file.
The docker-compose has two services:
- dev: lunches the express application using nodemon by running the script `dev` into package.js.
- ldap: starts the OpenLdap server, adds the groups and users from `./ldif/directory.ldif`.
Both services working on the same network `ldap` network. So the ldapjs client on `dev` has access to ldap through this config:
```javascript
const client = ldap.createClient({
url: "ldap://ldap:389"
});
```
## Starting the dev environment
To make thing more pleasant, I created a make file, so need to remember all docker commands to start your project. first of all, you necessitate to install the dependencies and start the dev server via docker-compose up, by typing:
```bash
make install
make dev
```
Hola! now you can request the user's search thought out the Rest API, via:
```bash
curl -X GET http://localhost:3000/users
```
Besides that, the search endpoint accepts `search` param query as cn filter for users search
```bash
curl -X GET http://localhost:3000/users\?search\=mo
```
## Bonus
### Generate a user password
```bash
docker exec ldap slappasswd -h {SSHA} -s admin
```