From 5cd07c69c62b602c9340efb45d5f9ac996638e34 Mon Sep 17 00:00:00 2001
From: Caetan <caetan.tojeiro.carpente@cern.ch>
Date: Wed, 30 Aug 2023 17:29:20 +0200
Subject: [PATCH 1/2] [#243] Fix logout

---
 .env.development                                 | 1 +
 .env.development.local                           | 1 +
 .env.development.local.nginx                     | 1 +
 .env.production                                  | 1 +
 .env.qa                                          | 1 +
 src/common/components/CERNToolBar/CERNToolBar.js | 2 +-
 6 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/.env.development b/.env.development
index af65345d..18818313 100644
--- a/.env.development
+++ b/.env.development
@@ -8,3 +8,4 @@ REACT_APP_NAME="CERN Notifications (Development)"
 REACT_APP_EXTERNAL_AUDIT_AVAILABLE_FROM_DATE=2022-05-23T00:00:00.000Z
 REACT_APP_EXTERNAL_AUDIT_ENABLED=true
 REACT_APP_AUTHORIZATION_URL=https://keycloak-qa.cern.ch/auth/realms/cern/protocol/openid-connect/auth
+REACT_APP_OAUTH_LOGOUT_URI=https://keycloak-qa.cern.ch/auth/realms/cern/protocol/openid-connect/logout
diff --git a/.env.development.local b/.env.development.local
index 4fff32f6..f2a5433f 100644
--- a/.env.development.local
+++ b/.env.development.local
@@ -5,3 +5,4 @@ REACT_APP_OAUTH_CLIENT_ID=notifications-dev
 REACT_APP_NODE_TLS_REJECT_UNAUTHORIZED=0
 REACT_APP_NAME="CERN Notifications (Local Development)"
 REACT_APP_AUTHORIZATION_URL=https://keycloak-qa.cern.ch/auth/realms/cern/protocol/openid-connect/auth
+REACT_APP_OAUTH_LOGOUT_URI=https://keycloak-qa.cern.ch/auth/realms/cern/protocol/openid-connect/logout
diff --git a/.env.development.local.nginx b/.env.development.local.nginx
index c9292702..52440842 100644
--- a/.env.development.local.nginx
+++ b/.env.development.local.nginx
@@ -4,3 +4,4 @@ REACT_APP_OAUTH_LOGOUT_URL=http://localhost/logout
 REACT_APP_NODE_TLS_REJECT_UNAUTHORIZED=0
 REACT_APP_NAME="CERN Notifications (Local Development)"
 REACT_APP_AUTHORIZATION_URL=https://keycloak-qa.cern.ch/auth/realms/cern/protocol/openid-connect/auth
+REACT_APP_OAUTH_LOGOUT_URI=https://keycloak-qa.cern.ch/auth/realms/cern/protocol/openid-connect/logout
diff --git a/.env.production b/.env.production
index 838b78fe..994221b5 100644
--- a/.env.production
+++ b/.env.production
@@ -7,3 +7,4 @@ REACT_APP_APPLE_WEBSERVICEURL=https://notifications.web.cern.ch/api/apple/safari
 REACT_APP_NAME="CERN Notifications"
 REACT_APP_ARCHIVE_URL=https://cern.ch/notifications-archives
 REACT_APP_EMAIL_GATEWAY_USER=notifications
+REACT_APP_OAUTH_LOGOUT_URI=https://auth.cern.ch/auth/realms/cern/protocol/openid-connect/logout
diff --git a/.env.qa b/.env.qa
index 7a48bbf5..039bf1c4 100644
--- a/.env.qa
+++ b/.env.qa
@@ -9,3 +9,4 @@ REACT_APP_ARCHIVE_URL=https://cern.ch/notifications-qa-archives
 REACT_APP_EMAIL_GATEWAY_USER=notifications.qa
 REACT_APP_EXTERNAL_AUDIT_AVAILABLE_FROM_DATE=2022-05-23T00:00:00.000Z
 REACT_APP_EXTERNAL_AUDIT_ENABLED=true
+REACT_APP_OAUTH_LOGOUT_URI=https://keycloak-qa.cern.ch/auth/realms/cern/protocol/openid-connect/logout
diff --git a/src/common/components/CERNToolBar/CERNToolBar.js b/src/common/components/CERNToolBar/CERNToolBar.js
index fdf7d416..81db4343 100644
--- a/src/common/components/CERNToolBar/CERNToolBar.js
+++ b/src/common/components/CERNToolBar/CERNToolBar.js
@@ -64,7 +64,7 @@ const CERNToolBarAuthenticated = ({logout}) => {
           <a
             className="cern-signout"
             title="Sign out of your account"
-            href={`https://auth.cern.ch/auth/realms/cern/protocol/openid-connect/logout?client_id=${process.env.REACT_APP_OAUTH_CLIENT_ID}&post_logout_redirect_uri=${process.env.REACT_APP_OAUTH_LOGOUT_URL}`}
+            href={`${process.env.REACT_APP_OAUTH_LOGOUT_URI}?client_id=${process.env.REACT_APP_OAUTH_CLIENT_ID}&post_logout_redirect_uri=${process.env.REACT_APP_OAUTH_LOGOUT_URL}`}
           >
             Sign out
           </a>
-- 
GitLab


From 0d07a2a4b10faa202f784eac329e156494b0ccec Mon Sep 17 00:00:00 2001
From: Caetan <caetan.tojeiro.carpente@cern.ch>
Date: Thu, 31 Aug 2023 10:02:12 +0200
Subject: [PATCH 2/2] Added logout URI on .env

---
 .env | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.env b/.env
index 041cf495..36eb825b 100644
--- a/.env
+++ b/.env
@@ -7,3 +7,4 @@ REACT_APP_FLAG_CATEGORY_ENABLED=true
 REACT_APP_EXTERNAL_AUDIT_AVAILABLE_FROM_DATE=2022-06-21T00:00:00.000Z
 REACT_APP_EXTERNAL_AUDIT_ENABLED=false
 REACT_APP_AUTHORIZATION_URL=https://auth.cern.ch/auth/realms/cern/protocol/openid-connect/auth
+REACT_APP_OAUTH_LOGOUT_URI=https://auth.cern.ch/auth/realms/cern/protocol/openid-connect/logout
-- 
GitLab