mirror of
https://github.com/ets-cfuhrman-pfe/EvalueTonSavoir.git
synced 2025-08-11 21:23:54 -04:00
added route to check if rooms need authentication
This commit is contained in:
parent
f648d028ab
commit
98e3887bcd
3 changed files with 23 additions and 0 deletions
|
|
@ -175,6 +175,17 @@ class AuthConfig {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if students must be authenticated to join a room
|
||||||
|
getRoomsRequireAuth() {
|
||||||
|
const roomRequireAuth = process.env.AUTHENTICATED_ROOMS;
|
||||||
|
|
||||||
|
if (!roomRequireAuth || roomRequireAuth !== "true") {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,17 @@ class authController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async getRoomsRequireAuth(req, res, next) {
|
||||||
|
const authC = new AuthConfig();
|
||||||
|
const roomsRequireAuth = authC.getRoomsRequireAuth();
|
||||||
|
|
||||||
|
const response = {
|
||||||
|
roomsRequireAuth
|
||||||
|
}
|
||||||
|
|
||||||
|
return res.json(response);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = new authController;
|
module.exports = new authController;
|
||||||
|
|
@ -5,5 +5,6 @@ const jwt = require('../middleware/jwtToken.js');
|
||||||
const authController = require('../controllers/auth.js')
|
const authController = require('../controllers/auth.js')
|
||||||
|
|
||||||
router.get("/getActiveAuth",authController.getActive);
|
router.get("/getActiveAuth",authController.getActive);
|
||||||
|
router.get("/getRoomsRequireAuth", authController.getRoomsRequireAuth);
|
||||||
|
|
||||||
module.exports = router;
|
module.exports = router;
|
||||||
Loading…
Reference in a new issue