# @koakh/nestjs-package-jwt-authentication-ldap

> Koakh NestJS Jwt Authentication LDAP

Latest version **1.0.70** (published 2025-07-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install @koakh/nestjs-package-jwt-authentication-ldap
pnpm add @koakh/nestjs-package-jwt-authentication-ldap
yarn add @koakh/nestjs-package-jwt-authentication-ldap
bun add @koakh/nestjs-package-jwt-authentication-ldap
```

## Health

**Score 50/100 (C)** — status: stable.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: stale.

## Facts

| | |
|---|---|
| Version | 1.0.70 |
| Published | 2025-07-29 |
| First published | 2020-12-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 21 |
| Unpacked size | 346.3 KB |
| Known vulnerabilities | 0 (+2 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Mário Monteiro |
| Maintainers | koakh |
| Keywords | nestjs |

## Links

- npm: https://www.npmjs.com/package/@koakh/nestjs-package-jwt-authentication-ldap
- Repository: https://github.com/koakh/NestJsPackageJwtAuthenticationLdap
- Homepage: https://github.com/koakh/NestJsPackageJwtAuthenticationLdap#readme
- Issues: https://github.com/koakh/NestJsPackageJwtAuthenticationLdap
- npm.io page: https://npm.io/package/@koakh/nestjs-package-jwt-authentication-ldap

## Dependencies (21)

- [rxjs](https://npm.io/package/rxjs.md) 7.8.2
- [uuid](https://npm.io/package/uuid.md) 11.1.0
- [bcrypt](https://npm.io/package/bcrypt.md) 5.1.1
- [dotenv](https://npm.io/package/dotenv.md) 16.5.0
- [ldapjs](https://npm.io/package/ldapjs.md) 2.3.3
- [express](https://npm.io/package/express.md) 5.1.0
- [passport](https://npm.io/package/passport.md) 0.7.0
- [@nestjs/jwt](https://npm.io/package/@nestjs/jwt.md) 11.0.0
- [@nestjs/core](https://npm.io/package/@nestjs/core.md) 11.1.0
- [passport-jwt](https://npm.io/package/passport-jwt.md) 4.0.1
- [@nestjs/common](https://npm.io/package/@nestjs/common.md) 11.1.0
- [@nestjs/config](https://npm.io/package/@nestjs/config.md) 4.0.2
- [passport-local](https://npm.io/package/passport-local.md) 1.0.0
- [@nestjs/swagger](https://npm.io/package/@nestjs/swagger.md) 11.1.6
- [class-validator](https://npm.io/package/class-validator.md) 0.14.2
- [@nestjs/passport](https://npm.io/package/@nestjs/passport.md) 11.0.5
- [reflect-metadata](https://npm.io/package/reflect-metadata.md) 0.2.2
- [passport-ldapauth](https://npm.io/package/passport-ldapauth.md) 3.0.1
- [@golevelup/ts-jest](https://npm.io/package/@golevelup/ts-jest.md) 0.6.2
- [@nestjs/platform-express](https://npm.io/package/@nestjs/platform-express.md) 11.1.0
- [@golevelup/nestjs-modules](https://npm.io/package/@golevelup/nestjs-modules.md) 0.7.2

## Recent versions

- 1.0.70 (latest) — 2025-07-29
- 1.0.69 — 2025-07-29
- 1.0.67 — 2025-04-03
- 1.0.66 — 2025-03-25
- 1.0.65 — 2025-03-19
- 1.0.64 — 2025-01-16
- 1.0.63 — 2024-12-20
- 1.0.62 — 2024-12-16
- 1.0.61 — 2024-04-01
- 1.0.60 — 2024-02-29
- 1.0.59 — 2024-02-28
- 1.0.58 — 2024-02-19
- 1.0.57 — 2024-02-01
- 1.0.56 — 2023-09-07
- 1.0.55 — 2022-09-05
- … 52 more at https://npm.io/package/@koakh/nestjs-package-jwt-authentication-ldap/versions

## README

# README

## Create a test package

```shell
# bootstrap a new nest test app
$ nest new test
$ cd test
# install deps
$ npm i
$ npm i @koakh/nestjs-package-jwt-authentication-ldap @nestjs/config
# edit AppModule
$ code src/app.module.ts
```

add `AuthModule` and `ConfigModule` from `@koakh/nestjs-package-jwt-authentication-ldap` and `@nestjs/config`

`src/app.module.ts`

```typescript
import { Module } from '@nestjs/common';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { AuthModule } from '@koakh/nestjs-package-jwt-authentication-ldap';
import { ConfigModule } from '@nestjs/config';

@Module({
  imports: [
    ConfigModule.forRoot({ isGlobal: true, }),
    AuthModule,
  ],
  controllers: [AppController],
  providers: [AppService],
})

export class AppModule { }
```

add a `test/.env` file

```conf
HTTP_SERVER_PORT="3010"
ACCESS_TOKEN_JWT_SECRET="secretKeyAccessToken"
ACCESS_TOKEN_EXPIRES_IN="15m"
REFRESH_TOKEN_JWT_SECRET="secretKeyRefreshToken"
REFRESH_TOKEN_EXPIRES_IN="7d"
REFRESH_TOKEN_SKIP_INCREMENT_VERSION="false"
LDAP_ADDRESS="192.168.1.1:2210"
LDAP_BIND_DN="cn=administrator,cn=users,dc=c3edu,dc=online"
LDAP_BIND_CREDENTIALS="secretCredentials"
LDAP_SEARCH_BASE="dc=c3edu,dc=online"
LDAP_SEARCH_USER_FILTER="(cn={{username}})"
LDAP_SEARCH_USER_ATTRIBUTES="cn,givenName,sn,displayName,userPrincipalName,memberOf,userAccountControl,objectCategory,distinguishedName,mail,lastLogonTimestamp,gender,c3UserRole,dateOfBirth,studentID,telephoneNumber,extraPermission"
LDAP_SEARCH_CACHE_FILTER="(objectCategory=CN=Person,CN=Schema,CN=Configuration,DC=c3edu,DC=online)"
LDAP_BASE_DN="dc=c3edu,dc=online"
LDAP_NEW_USER_DN_POSTFIX="ou=C3student,ou=People"
OPENAPI_TITLE="Consumer App"
OPENAPI_DESCRIPTION="Koakh NestJS Jwt Authentication Package LDAP Consumer App"
OPENAPI_VERSION="1.0.0"
OPENAPI_TAG="nestjs, typescript, ldap, auth, security"
```

## Run App

```shell
$ npm run start:dev
```

## Test Endpoints

```shell
# clone client.http
wget https://raw.githubusercontent.com/koakh/NestJsPackageJwtAuthentication/main/client.http
```

> Note: required the awesome [REST Client](https://marketplace.visualstudio.com/items?itemName=humao.rest-client)

now test all requests

or test with a simple curl

```shell
$ curl --request POST \
  --url http://localhost:3010/auth/login \
  --header 'content-type: application/json' \
  --header 'user-agent: vscode-restclient' \
  --data '{"username": "admin","password": "12345678"}' \
  | jq

{
  "user": {
    "id": "efeed3eb-c0a2-4b3e-816f-2a42ca8451b3",
    "username": "admin",
    "givenName": "Pietra",
    "sn": "Heine",
    "email": "pheine0@illinois.edu",
    "roles": [
      "USER",
      "ADMIN"
    ],
    "createdDate": 1597444307,
    "metaData": {
      "key": "value"
    }
  },
  "accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9........"
}
```

we are done

---
_Source: https://npm.io/package/@koakh/nestjs-package-jwt-authentication-ldap · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
