feat(backend): Generic authentication checks.

Added support for deciding based on any predicate about the current AuthenticationInfo whether or not a request will be accepted.
This commit is contained in:
Gerald Schmittinger 2025-03-02 01:24:49 +01:00
parent 054e761baa
commit 69ba8c9567
2 changed files with 29 additions and 16 deletions

View file

@ -1,6 +1,9 @@
import { Request } from "express";
import { JwtPayload } from "jsonwebtoken";
import {AuthenticationInfo} from "./authentication-info";
export interface AuthenticatedRequest extends Request {
auth?: JwtPayload; // Optional, as req.auth might be undefined if authentication is optional
// Properties are optional since the user is not necessarily authenticated.
jwtPayload?: JwtPayload;
auth?: AuthenticationInfo;
}