Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/constlab/vesper-jwt-auth
https://github.com/constlab/vesper-jwt-auth
graphql jwt jwt-auth typescript vesper
Last synced: 18 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/constlab/vesper-jwt-auth
- Owner: constlab
- License: mit
- Created: 2018-08-13T13:13:16.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-07-16T08:24:38.000Z (over 4 years ago)
- Last Synced: 2024-04-26T14:41:50.678Z (9 months ago)
- Topics: graphql, jwt, jwt-auth, typescript, vesper
- Language: TypeScript
- Size: 143 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Vesper JWT Auth
[![Build Status](https://travis-ci.org/constlab/vesper-jwt-auth.svg?branch=master)](https://travis-ci.org/constlab/vesper-jwt-auth)
## 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)```typescript
import { AuthModule, jwtAuthorizationCheck } from "@constlab/vesper-jwt-auth";
bootstrap({
port: 3000,
parameters: {
"salt": ""
},
modules: [AuthModule, UserModule],
setupContainer: async (container, action) => {
container.set("user.repository", getRepository(User));
},
authorizationChecker: (roles: string[], action) => jwtAuthorizationCheck(roles, action)
});
```