Add teamleader authentication

This commit is contained in:
Stephan
2022-05-27 22:48:16 +02:00
parent 197d1a52a3
commit a9c182cf64
3 changed files with 79 additions and 2 deletions
+2 -2
View File
@@ -8,9 +8,9 @@ import prisma from "../../lib/prisma";
const JWT_SECRET = process.env.JWT_SECRET || "secret";
const verifyAuthorizationFormat = (authorization: string) => /^Bearer .+$/.test(authorization);
export const verifyAuthorizationFormat = (authorization: string) => /^Bearer .+$/.test(authorization);
const getBearerToken = (authorization: string) => authorization.slice(7);
export const getBearerToken = (authorization: string) => authorization.slice(7);
export const requireAuthentication = async (req: Request, res: Response, next: NextFunction) => {
const { authorization } = req.headers;