diff --git a/gatewayservice/gateway-service.js b/gatewayservice/gateway-service.js index 45942814..ef7e0589 100644 --- a/gatewayservice/gateway-service.js +++ b/gatewayservice/gateway-service.js @@ -52,6 +52,10 @@ app.post('/adduser', async (req, res) => { app.get('/generate-question', async (req, res) => { try { // Forward the generate question request to the question service + const bearerHeader = req.headers['authorization']; + if(! bearerHeader ){ + return res.sendStatus(403); + } const questionResponse = await axios.get(generatorServiceUrl+'/generate-question'); res.json(questionResponse.data); } catch (error) { @@ -73,6 +77,10 @@ app.get('/statistics', async (req, res) => { app.get('/questions', async (req, res) => { try { + const bearerHeader = req.headers['authorization']; + if(! bearerHeader ){ + return res.sendStatus(403); + } // Forward the get questions request to the question service const questionResponse = await axios.get(questionServiceUrl+'/questions'); res.json(questionResponse.data); diff --git a/webapp/src/components/Navbar.js b/webapp/src/components/Navbar.js index f6eac486..b4d9dac1 100644 --- a/webapp/src/components/Navbar.js +++ b/webapp/src/components/Navbar.js @@ -1,8 +1,11 @@ import React from "react"; import { NavLink } from "react-router-dom"; +import { useAuth } from "./login/AuthProvider"; import "./Navbar.css"; const Navbar = () => { + const { nombreUsuario } = useAuth(); + return (