diff --git a/ExpressAPI/src/middlewares/SecurityMiddleware.ts b/ExpressAPI/src/middlewares/SecurityMiddleware.ts index bfe307ecf2adf5b1cbc774565add672d5022df09..1b7edc42e2627092f570a3ddd8a00cd0225f38d3 100644 --- a/ExpressAPI/src/middlewares/SecurityMiddleware.ts +++ b/ExpressAPI/src/middlewares/SecurityMiddleware.ts @@ -26,6 +26,8 @@ class SecurityMiddleware { return req.boundParams.assignment?.published ?? false; case SecurityCheckType.EXERCISE_SECRET.valueOf(): return (req.headers.exercisesecret as string | undefined) === req.boundParams.exercise!.secret; + case SecurityCheckType.ASSIGNMENT_SECRET: + return (req.headers.assignmentsecret as string | undefined) === req.boundParams.assignment!.secret; default: return false; } diff --git a/ExpressAPI/src/types/SecurityCheckType.ts b/ExpressAPI/src/types/SecurityCheckType.ts index e6f122b576e49776c4c398a124ae7fcabc9c6367..9cbb61bc2a23583e021c84a7cc9e17b7579ccfd7 100644 --- a/ExpressAPI/src/types/SecurityCheckType.ts +++ b/ExpressAPI/src/types/SecurityCheckType.ts @@ -5,6 +5,7 @@ enum SecurityCheckType { ASSIGNMENT_STAFF = 'assignmentStaff', ASSIGNMENT_IS_PUBLISHED = 'assignmentIsPublished', EXERCISE_SECRET = 'exerciseSecret', + ASSIGNMENT_SECRET = 'assignmentSecret', }