@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user