From 83080d26520ee504de98aa2a080b23376b37f417 Mon Sep 17 00:00:00 2001 From: rdbsolutions Date: Mon, 13 Dec 2021 15:55:10 +0000 Subject: [PATCH] update sec headers applied --- .env.local | 4 ++-- components/myportal.js | 5 ++--- next.config.js | 2 +- pages/myportal/index.js | 31 ++++++++++++++++++++++++++++++- 4 files changed, 35 insertions(+), 7 deletions(-) diff --git a/.env.local b/.env.local index 407ee81d..46ec5624 100644 --- a/.env.local +++ b/.env.local @@ -60,9 +60,9 @@ I18N_DOMAIN = "cymru.local" GG_PROVIDER_CONFIG_ENDPOINT = "https://api.ete.access.service.gov.uk/.well-known/openid-configuration" GG_CLIENT_ID = 5vTukeSpN7d6uBV7YLb7A5wOctzzkZ GG_CLIENT_SECRET = z1PGLAKPxIhjMBegTdzX22AayIORc1GsCbMQZ6mieBn7zChjzzxup5lkIByEmsYS -GG_REDIRECT_URI = "https://dev-planningcasework.service.gov.wales" +GG_REDIRECT_URI = "http://localhost:3000" NEXT_PUBLIC_GG_CLIENT_ID = 5vTukeSpN7d6uBV7YLb7A5wOctzzkZ -NEXT_PUBLIC_GG_REDIRECT_URI = "https://dev-planningcasework.service.gov.wales" +NEXT_PUBLIC_GG_REDIRECT_URI = "http://localhost:3000" diff --git a/components/myportal.js b/components/myportal.js index 86fd820d..524ae3ad 100644 --- a/components/myportal.js +++ b/components/myportal.js @@ -55,7 +55,7 @@ const MyPortal = (props) => { const handleLogout = () => { destroyCookie({}, "pinsUser"), window.localStorage.clear(), - router.replace("/"); + router.replace(props.ggLogout); }; return ( @@ -97,8 +97,7 @@ const MyPortal = (props) => { > { - destroyCookie({}, "pinsUser"), - window.localStorage.clear(); + handleLogout(); }} className="govuk-header__link govuk-!-margin-right-3" > diff --git a/next.config.js b/next.config.js index 6137546c..0db360de 100644 --- a/next.config.js +++ b/next.config.js @@ -42,7 +42,7 @@ module.exports = { return [ { // Apply these headers to all routes in your application. - source: "/(.*)", + source: "/(.*)?", headers: securityHeaders, }, ]; diff --git a/pages/myportal/index.js b/pages/myportal/index.js index d7da7060..d38fb99e 100644 --- a/pages/myportal/index.js +++ b/pages/myportal/index.js @@ -34,6 +34,8 @@ import { setAwaitingSubmission, setAwaitingSubmissionDetails, } from "../../store/awaitingSubmission/action"; +import { getGovGatewayConfig } from "../../store/govgateway/action"; + import { getToken, getPersonalAccount, @@ -44,6 +46,13 @@ import { getPortalModuleDetails, } from "../../actions"; +import { + getProviderConfig, + getGGToken, + getUserInfo, + getPortalLogin, +} from "../../actions/govgateway"; + const Home = (props) => { const { footerLinks, @@ -53,6 +62,7 @@ const Home = (props) => { watchedCases, awaitingSubmission, accountDetails, + govGateway, } = props; let { t, lang } = useTranslation(); @@ -139,6 +149,7 @@ const Home = (props) => { watchedCases={watchedCases} awaitingSubmission={awaitingSubmission} accountDetails={accountDetails} + ggLogout={govGateway.config.end_session_endpoint} />