parent
f2c50e929e
commit
f96b256ad3
|
@ -1,8 +1,8 @@
|
|||
import { Request, Response } from 'express';
|
||||
|
||||
/**
|
||||
* Custom express middleware that appends the raw body to the request obeject.
|
||||
* Mainly used for parsing csvs from boddies.
|
||||
* Custom express middleware that appends the raw body to the request object.
|
||||
* Mainly used for parsing csvs from bodies.
|
||||
*/
|
||||
|
||||
const RawBodyMiddleware = (req: Request, res: Response, next: () => void) => {
|
||||
|
|
|
@ -5,8 +5,9 @@ import { ScanStation } from '../models/entities/ScanStation';
|
|||
import authchecker from './authchecker';
|
||||
|
||||
/**
|
||||
* This middleware handels the authentification of scan station api tokens.
|
||||
* The tokens have to be provided via Bearer auth header.
|
||||
* This middleware handles the authentication of scan station api tokens.
|
||||
* The tokens have to be provided via Bearer authorization header.
|
||||
* You have to manually use this middleware via @UseBefore(ScanAuth) instead of using @Authorized().
|
||||
* @param req Express request object.
|
||||
* @param res Express response object.
|
||||
* @param next Next function to call on success.
|
||||
|
@ -31,7 +32,7 @@ const ScanAuth = async (req: Request, res: Response, next: () => void) => {
|
|||
}
|
||||
finally {
|
||||
if (prefix == "" || prefix == undefined || prefix == null) {
|
||||
res.status(401).send("Api token non-existant or invalid syntax.");
|
||||
res.status(401).send("Api token non-existent or invalid syntax.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -45,7 +46,7 @@ const ScanAuth = async (req: Request, res: Response, next: () => void) => {
|
|||
}
|
||||
finally {
|
||||
if (user_authorized == false) {
|
||||
res.status(401).send("Api token non-existant or invalid syntax.");
|
||||
res.status(401).send("Api token non-existent or invalid syntax.");
|
||||
return;
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -5,8 +5,9 @@ import { StatsClient } from '../models/entities/StatsClient';
|
|||
import authchecker from './authchecker';
|
||||
|
||||
/**
|
||||
* This middleware handels the authentification of stats client api tokens.
|
||||
* The tokens have to be provided via Bearer auth header.
|
||||
* This middleware handles the authentication of stats client api tokens.
|
||||
* The tokens have to be provided via Bearer authorization header.
|
||||
* You have to manually use this middleware via @UseBefore(StatsAuth) instead of using @Authorized().
|
||||
* @param req Express request object.
|
||||
* @param res Express response object.
|
||||
* @param next Next function to call on success.
|
||||
|
|
|
@ -8,7 +8,7 @@ import { JwtCreator, JwtUser } from '../jwtcreator';
|
|||
import { User } from '../models/entities/User';
|
||||
|
||||
/**
|
||||
* Handels authorisation verification via jwt's for all api endpoints using the @Authorized decorator.
|
||||
* Handles authentication via jwt's (Bearer authorization header) for all api endpoints using the @Authorized decorator.
|
||||
* @param action Routing-Controllers action object that provides request and response objects among other stuff.
|
||||
* @param permissions The permissions that the endpoint using @Authorized requires.
|
||||
*/
|
||||
|
@ -43,7 +43,7 @@ const authchecker = async (action: Action, permissions: string[] | string) => {
|
|||
}
|
||||
|
||||
/**
|
||||
* Handels soft-refreshing of access-tokens.
|
||||
* Handles soft-refreshing of access-tokens.
|
||||
* @param action Routing-Controllers action object that provides request and response objects among other stuff.
|
||||
*/
|
||||
const refresh = async (action: Action) => {
|
||||
|
|
Loading…
Reference in New Issue