Merge branch 'chore/login' into docs/swagger-autogen

This commit is contained in:
Tibo De Peuter 2025-03-09 09:27:42 +01:00
commit bf36790b28
Signed by: tdpeuter
GPG key ID: 38297DE43F75FFE2
30 changed files with 5058 additions and 315 deletions

View file

@ -0,0 +1,23 @@
import express from 'express'
import {getFrontendAuthConfig} from "../controllers/auth.js";
import {authenticatedOnly, studentsOnly, teachersOnly} from "../middleware/auth/auth.js";
const router = express.Router();
// returns auth configuration for frontend
router.get('/config', (req, res) => {
res.json(getFrontendAuthConfig());
});
router.get('/testAuthenticatedOnly', authenticatedOnly, (req, res) => {
res.json({message: "If you see this, you should be authenticated!"});
});
router.get('/testStudentsOnly', studentsOnly, (req, res) => {
res.json({message: "If you see this, you should be a student!"});
});
router.get('/testTeachersOnly', teachersOnly, (req, res) => {
res.json({message: "If you see this, you should be a teacher!"});
});
export default router;

View file

@ -1,14 +0,0 @@
import express from 'express';
const router = express.Router();
// Returns login paths for IDP
router.get('/', (req, res) => {
res.json({
// Dummy variables, needs to be changed
// With IDP endpoints
leerkracht: '/login-leerkracht',
leerling: '/login-leerling',
});
});
export default router;