1.0.4 • Published 3 years ago

manojs-nestcloak v1.0.4

Weekly downloads
6
License
MIT
Repository
-
Last release
3 years ago

Manojs nestCloak

Work in progress

This module was brought to you by Manoj.

A simple nestJS module that allows quick integration with a keycloak instance. Simply npm install and import the module like:

Screenshot

The configService is a service that exposes one function, get. The get function takes in one argument, a string, and returns config values pertaining to that string. It can be implemented in many ways; For instance it can be a function like:

get(key: string): string { return process.env[key]; }

The config service is provided by the configModule. A simple module that provides ONLY the configService and does nothing else (For more information see official nestJS docs: https://docs.nestjs.com/techniques/configuration)

Using the module:

The configservice's get function should return values for 3 strings:

CLOAKURL - keycloak url without /auth REALM - realm name CLIENTID - id of the client in keycloak MASTERREALM - usually 'master' MASTERCLIENTID - usually admin-cli by default ADMINUSERNAME - admin username ADMINPW - admin pw

ie; When i call get('CLOAKURL') it should return the url of the keycloak instance like: http://localhost:3422

If all 3 values are correctly provided. Then importing the module will create a controller in the background.

The controller can be accessed at:

/auth-controller/

Endpoints are:

LOGIN

POST /auth-controller/login

with body:

{"username":string,"password":string}

It will automatically retrieve the response from keycloak for that combination.

1.0.4

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.3

3 years ago

1.0.0

3 years ago