@constlab/vesper-jwt-auth
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

Vesper JWT Auth

Build Status

Early access. Not for production use

Initial setup

  1. npm i @constlab/vesper-jwt-auth
  2. Add AuthModule to bootstrap
  3. Add UserRepository to DI container
  4. Add authorization checker function
  5. Add salt to parameters (see https://github.com/vesper-framework/vesper/blob/master/src/options/SchemaBuilderOptions.ts#L85)
import { AuthModule, jwtAuthorizationCheck } from "@constlab/vesper-jwt-auth";

bootstrap({
   port: 3000,
   parameters: {
   	"salt": "<random string>"
   },
   modules: [AuthModule, UserModule],
   setupContainer: async (container, action) => {
   	container.set("user.repository", getRepository(User));
   },
   authorizationChecker: (roles: string[], action) => jwtAuthorizationCheck(roles, action)
});

/@constlab/vesper-jwt-auth/

    Package Sidebar

    Install

    npm i @constlab/vesper-jwt-auth

    Weekly Downloads

    16

    Version

    0.1.0

    License

    MIT

    Unpacked Size

    69.7 kB

    Total Files

    58

    Last publish

    Collaborators

    • frymmox
    • kalinichenko
    • maxsof