2.0.0-alpha.5 • Published 11 months ago

@natlibfi/passport-melinda-jwt v2.0.0-alpha.5

Weekly downloads
-
License
MIT+
Repository
github
Last release
11 months ago

Passport authentication strategy for Melinda using jwt tokens

Melinda implementation of passport + jwt token authorization

How to implement in server side

Create JWT token

import {generateJwtToken} from '@natlibfi/passport-melinda-jwt';
const token: generateJwtToken(payload, {
  secretOrPrivateKey,
  issuer,
  audience,
  algorithm
});
  • secretOrPrivateKey: secret
  • issuer: String value of issuer
  • audience: String value of audience
  • algorithm: encryption method default: 'HS512'

Check JWT token

import MelindaJwtStrategy, {verify, jwtFromRequest} from '@natlibfi/passport-melinda-jwt';

passport.use(new MelindaJwtStrategy({
  secretOrKey
  issuer,
  audience,
  algorithms,
  jwtFromRequest
}, verify));
  • secretOrKey: secret
  • issuer: String value of issuer
  • audience: String value of audience
  • algorithms: String array, e.g. 'HS512'
  • jwtFromRequest: Function that gets token from request (Default contained in this repository)
  • verify: Function to verify token content (Default contained in this repository)

How to implement in client side

headers: {
  Authorization: token,
}
  • Send token as authorization header in requests

License and copyright

Copyright (c) 2021-2024 University Of Helsinki (The National Library Of Finland)

This project's source code is licensed under the terms of MIT or any later version.

1.0.8-alpha.1

1 year ago

2.0.0-alpha.4

1 year ago

2.0.0-alpha.5

11 months ago

1.0.7

1 year ago

1.0.7-alpha.1

1 year ago

1.0.6-alpha.1

1 year ago

1.0.6

1 year ago

2.0.0-alpha.2

1 year ago

2.0.0-alpha.1

1 year ago

1.0.5-alpha.1

2 years ago

1.0.5

2 years ago

1.0.4-alpha.1

2 years ago

1.0.4

2 years ago

1.0.3-alpha.1

2 years ago

1.0.3

2 years ago

1.0.2

3 years ago

1.0.2-alpha.1

3 years ago

1.0.1

4 years ago

1.0.0

4 years ago