Skip to content

SudoSOS Back-end API / internal/middleware / RestrictionMiddleware

Class: RestrictionMiddleware ​

Constructors ​

Constructor ​

ts
new RestrictionMiddleware(restrictionsImplementation?): RestrictionMiddleware;

Parameters ​

ParameterType
restrictionsImplementation?() => Partial<TokenRestrictions>

Returns ​

RestrictionMiddleware

Methods ​

getMiddleware() ​

ts
getMiddleware(): RequestHandler;

Returns ​

RequestHandler

a middleware handler to be used by express.


handle() ​

ts
handle(
   req, 
   res, 
next): Promise<void>;

Middleware handler for enforcing restrictions on tokens.

Parameters ​

ParameterTypeDescription
reqRequestWithTokenthe express request to handle.
resResponsethe express response object.
nextFunctionthe express next function to continue processing of the request.

Returns ​

Promise<void>