README
Hotelbird Logging package
Node package for the logging-service. with types
Environment Variables
- [optional] DISABLE_JWT (default: undefined) TRUE in none production mode, will skip the validation middleware
- [optional] NODE_ENV (default: undefined) in production mode, the middleware-disable will not work
How to use
init Jwt express Validator:
load the library and set the configuration with setJwtConfig
import { JwtExpressValidator } from 'jwt-express-validator';
import jwtConfig from '../config/jwt-config.json';
JwtExpressValidator.setJwtConfig({
algorithm: jwtConfig.algorithm,
rsa_public_key: jwtConfig.rsa_public_key
});
use Jwt express Validator:
load the library and set the configuration with setJwtConfig
Parameter:
- list of scopes
- or / and condition true = or | false = and
JwtExpressValidator.jwtValidator(['permission:read', '...'], /* or */ true)
add to Route
all mentioned scopes are required to access this route
Current values (v1.2.0)
app.get(
'/scope',
JwtExpressValidator.jwtValidator(['permission:read', '...'], true),
(req, res) => new Handler.Scope().getScopes(req, res)
);