Loading .DS_Store 0 → 100644 +6 KiB File added.No diff preview for this file type. View file capif_frontend/.env +2 −2 Original line number Diff line number Diff line NEXT_PUBLIC_JWT_EXPIRATION=5m NEXT_PUBLIC_JWT_SECRET=dd5f3089-40c3-403d-af14-d0c228b05cb4 NEXT_PUBLIC_JWT_REFRESH_TOKEN_SECRET=7c4c1c50-3230-45bf-9eae-c9b2e401c767 NEXT_PUBLIC_API_BASE_URL="https://backoffice-be-capif.mobilesandbox.cloud/" NEXT_PUBLIC_GRAFANA_BASE_URL="http://10.95.82.71:3000" NEXT_PUBLIC_API_BASE_URL="https://backoffice-api.mobilesandbox.cloud:38443" NEXT_PUBLIC_GRAFANA_BASE_URL="https://grafana.5gnacar.int" capif_frontend/Dockerfile +4 −7 Original line number Diff line number Diff line # Use Nginx as the production server # Usa la imagen oficial de Nginx desde Docker Hub FROM nginx # Copy the built React app to Nginx's web server directory # Copia el contenido estático desde el directorio local al directorio del servidor Nginx COPY ./out /usr/share/nginx/html # Expose port 80 for the Nginx server # Expone el puerto 8080 del contenedor EXPOSE 80 No newline at end of file # Start Nginx when the container runs CMD ["nginx", "-g", "daemon off;"] No newline at end of file capif_frontend/src/context/AuthContext.js +3 −9 Original line number Diff line number Diff line Loading @@ -63,13 +63,12 @@ const AuthProvider = ({ children }) => { // auth/me -> se le envía el token de acceso y devuelve 200 si es válido o 401 si no lo es const response = await axiosInstance.get(authConfig.meEndpoint, { // https://10.95.82.71:8085/auth/me + Authorization: Bearer token headers: { headers: { "Access-Control-Allow-Origin": "*" }, "access-control-allow-origin" : "*", Authorization: `Bearer ${storedAccessToken}` } }) // getUserData() -> devuelve el objeto JSON almacenado en la cookie USER_DATA_KEY setUser(getUserData()) setUser(getUserData()) // getUserData() -> devuelve el objeto JSON almacenado en la cookie USER_DATA_KEY setLoading(false) // SI EL TOKEN FALLA, Loading Loading @@ -107,7 +106,7 @@ const AuthProvider = ({ children }) => { formData.append('username', params.username) formData.append('password', params.password) console.log(' authConfig.loginEndpoint: ', authConfig.loginEndpoint) console.log(' authConfig.loginEndpoint: ', authConfig.loginEndpoint) // /login const response = await axiosInstance.post(authConfig.loginEndpoint, formData, { headers: { Loading @@ -122,24 +121,19 @@ const AuthProvider = ({ children }) => { if (params.rememberMe) { setAccessToken(response.data.access_token) //setAccessToken("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJmcmVzaCI6ZmFsc2UsImlhdCI6MTcwNTQxMzYwMiwianRpIjoiMDI2OGVjOWYtM2RjZi00NmUwLWJjY2MtODY3MGVjNmYzYjYwIiwidHlwZSI6ImFjY2VzcyIsInN1YiI6InN1cGVyYWRtaW4iLCJuYmYiOjE3MDU0MTM2MDJ9.LdElQXwgDOwnP8MVWP2Sh29OlwXnHShEjCv17Wn698o") const pruebatoken = getAccessToken() console.log(' prueba getaccesstoken: ', pruebatoken) setRefreshToken(response.data.refresh_token) //setRefreshToken("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJmcmVzaCI6ZmFsc2UsImlhdCI6MTcwNTQxMzYwMiwianRpIjoiZjhlNzJiZjMtMDhlYy00MzBjLTg2ODUtZTgzMzdhMTQ3NjgwIiwidHlwZSI6InJlZnJlc2giLCJzdWIiOiJzdXBlcmFkbWluIiwibmJmIjoxNzA1NDEzNjAyLCJleHAiOjE3MDgwMDU2MDJ9.w38lYPBSqbkOB31Rfs5WJD3AxblgFAe5NqpDgxSUP5s") setUserData({ username: params.username, role: 'admin' }) } const returnUrl = router.query.returnUrl console.log(' returnUrl: ', returnUrl) console.log(' params.username: ', params.usernamel) setUser({ username: params.username, role: 'admin' }) const redirectURL = returnUrl && returnUrl !== '/' ? returnUrl : '/' router.replace(redirectURL) const prueba = getAccessToken() console.log(' prueba token seteado: ', prueba) } catch (err) { console.log(err) Loading docker-compose.yml +2 −7 Original line number Diff line number Diff line Loading @@ -6,10 +6,5 @@ services: context: ./capif_frontend restart: unless-stopped ports: - "4000:3000" environment: - NEXT_PUBLIC_JWT_EXPIRATION=5m - NEXT_PUBLIC_JWT_SECRET=dd5f3089-40c3-403d-af14-d0c228b05cb4 - NEXT_PUBLIC_JWT_REFRESH_TOKEN_SECRET=7c4c1c50-3230-45bf-9eae-c9b2e401c767 - NEXT_PUBLIC_API_BASE_URL="https://backoffice-be-capif.mobilesandbox.cloud/" - NEXT_PUBLIC_GRAFANA_BASE_URL="http://10.95.82.71:3000" - "4000:80" Loading
capif_frontend/.env +2 −2 Original line number Diff line number Diff line NEXT_PUBLIC_JWT_EXPIRATION=5m NEXT_PUBLIC_JWT_SECRET=dd5f3089-40c3-403d-af14-d0c228b05cb4 NEXT_PUBLIC_JWT_REFRESH_TOKEN_SECRET=7c4c1c50-3230-45bf-9eae-c9b2e401c767 NEXT_PUBLIC_API_BASE_URL="https://backoffice-be-capif.mobilesandbox.cloud/" NEXT_PUBLIC_GRAFANA_BASE_URL="http://10.95.82.71:3000" NEXT_PUBLIC_API_BASE_URL="https://backoffice-api.mobilesandbox.cloud:38443" NEXT_PUBLIC_GRAFANA_BASE_URL="https://grafana.5gnacar.int"
capif_frontend/Dockerfile +4 −7 Original line number Diff line number Diff line # Use Nginx as the production server # Usa la imagen oficial de Nginx desde Docker Hub FROM nginx # Copy the built React app to Nginx's web server directory # Copia el contenido estático desde el directorio local al directorio del servidor Nginx COPY ./out /usr/share/nginx/html # Expose port 80 for the Nginx server # Expone el puerto 8080 del contenedor EXPOSE 80 No newline at end of file # Start Nginx when the container runs CMD ["nginx", "-g", "daemon off;"] No newline at end of file
capif_frontend/src/context/AuthContext.js +3 −9 Original line number Diff line number Diff line Loading @@ -63,13 +63,12 @@ const AuthProvider = ({ children }) => { // auth/me -> se le envía el token de acceso y devuelve 200 si es válido o 401 si no lo es const response = await axiosInstance.get(authConfig.meEndpoint, { // https://10.95.82.71:8085/auth/me + Authorization: Bearer token headers: { headers: { "Access-Control-Allow-Origin": "*" }, "access-control-allow-origin" : "*", Authorization: `Bearer ${storedAccessToken}` } }) // getUserData() -> devuelve el objeto JSON almacenado en la cookie USER_DATA_KEY setUser(getUserData()) setUser(getUserData()) // getUserData() -> devuelve el objeto JSON almacenado en la cookie USER_DATA_KEY setLoading(false) // SI EL TOKEN FALLA, Loading Loading @@ -107,7 +106,7 @@ const AuthProvider = ({ children }) => { formData.append('username', params.username) formData.append('password', params.password) console.log(' authConfig.loginEndpoint: ', authConfig.loginEndpoint) console.log(' authConfig.loginEndpoint: ', authConfig.loginEndpoint) // /login const response = await axiosInstance.post(authConfig.loginEndpoint, formData, { headers: { Loading @@ -122,24 +121,19 @@ const AuthProvider = ({ children }) => { if (params.rememberMe) { setAccessToken(response.data.access_token) //setAccessToken("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJmcmVzaCI6ZmFsc2UsImlhdCI6MTcwNTQxMzYwMiwianRpIjoiMDI2OGVjOWYtM2RjZi00NmUwLWJjY2MtODY3MGVjNmYzYjYwIiwidHlwZSI6ImFjY2VzcyIsInN1YiI6InN1cGVyYWRtaW4iLCJuYmYiOjE3MDU0MTM2MDJ9.LdElQXwgDOwnP8MVWP2Sh29OlwXnHShEjCv17Wn698o") const pruebatoken = getAccessToken() console.log(' prueba getaccesstoken: ', pruebatoken) setRefreshToken(response.data.refresh_token) //setRefreshToken("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJmcmVzaCI6ZmFsc2UsImlhdCI6MTcwNTQxMzYwMiwianRpIjoiZjhlNzJiZjMtMDhlYy00MzBjLTg2ODUtZTgzMzdhMTQ3NjgwIiwidHlwZSI6InJlZnJlc2giLCJzdWIiOiJzdXBlcmFkbWluIiwibmJmIjoxNzA1NDEzNjAyLCJleHAiOjE3MDgwMDU2MDJ9.w38lYPBSqbkOB31Rfs5WJD3AxblgFAe5NqpDgxSUP5s") setUserData({ username: params.username, role: 'admin' }) } const returnUrl = router.query.returnUrl console.log(' returnUrl: ', returnUrl) console.log(' params.username: ', params.usernamel) setUser({ username: params.username, role: 'admin' }) const redirectURL = returnUrl && returnUrl !== '/' ? returnUrl : '/' router.replace(redirectURL) const prueba = getAccessToken() console.log(' prueba token seteado: ', prueba) } catch (err) { console.log(err) Loading
docker-compose.yml +2 −7 Original line number Diff line number Diff line Loading @@ -6,10 +6,5 @@ services: context: ./capif_frontend restart: unless-stopped ports: - "4000:3000" environment: - NEXT_PUBLIC_JWT_EXPIRATION=5m - NEXT_PUBLIC_JWT_SECRET=dd5f3089-40c3-403d-af14-d0c228b05cb4 - NEXT_PUBLIC_JWT_REFRESH_TOKEN_SECRET=7c4c1c50-3230-45bf-9eae-c9b2e401c767 - NEXT_PUBLIC_API_BASE_URL="https://backoffice-be-capif.mobilesandbox.cloud/" - NEXT_PUBLIC_GRAFANA_BASE_URL="http://10.95.82.71:3000" - "4000:80"