From cb55ce63b5500bfe6284c5924410e39f104ec526 Mon Sep 17 00:00:00 2001
From: "Oladimeji S. Awe" <olaawe@ceh.ac.uk>
Date: Wed, 15 Nov 2023 14:01:26 +0000
Subject: [PATCH 1/2] changing web app settings to use custom domain

---
 .../config/local/web_auth_config.json              | 14 +++++++-------
 code/workspaces/auth-service/src/config/config.js  |  2 +-
 .../common/src/config/web_auth_config.json         | 14 +++++++-------
 .../workspaces/web-app/public/web_auth_config.json | 14 +++++++-------
 4 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/code/development-env/config/local/web_auth_config.json b/code/development-env/config/local/web_auth_config.json
index 3d969b72e..8240b927b 100644
--- a/code/development-env/config/local/web_auth_config.json
+++ b/code/development-env/config/local/web_auth_config.json
@@ -5,7 +5,7 @@
       "redirect_uri": "https://testlab.datalabs.localhost/callback",
       "response_type": "code",
       "scope": "openid profile",
-      "authority": "https://mjbr.eu.auth0.com",
+      "authority": "https://login.datalabs.ceh.ac.uk",
       "automaticSilentRenew": true,
       "accessTokenExpiringNotificationTime": 600,
       "filterProtocolClaims": true,
@@ -14,12 +14,12 @@
         "audience": "https://datalab.datalabs.nerc.ac.uk/api"
       },
       "metadata": {
-        "issuer": "https://mjbr.eu.auth0.com/",
-        "authorization_endpoint": "https://mjbr.eu.auth0.com/authorize",
-        "userinfo_endpoint": "https://mjbr.eu.auth0.com/userinfo",
-        "end_session_endpoint": "https://mjbr.eu.auth0.com/v2/logout?returnTo=https://testlab.datalabs.localhost/&client_id=Xf62MEzjqxfaId1DVWnFul61D9oA3eMt",
-        "jwks_uri": "https://mjbr.eu.auth0.com/.well-known/jwks.json",
-        "token_endpoint": "https://mjbr.eu.auth0.com/oauth/token"
+        "issuer": "https://login.datalabs.ceh.ac.uk/",
+        "authorization_endpoint": "https://login.datalabs.ceh.ac.uk/authorize",
+        "userinfo_endpoint": "https://login.datalabs.ceh.ac.uk/userinfo",
+        "end_session_endpoint": "https://login.datalabs.ceh.ac.uk/v2/logout?returnTo=https://testlab.datalabs.localhost/&client_id=Xf62MEzjqxfaId1DVWnFul61D9oA3eMt",
+        "jwks_uri": "https://login.datalabs.ceh.ac.uk/.well-known/jwks.json",
+        "token_endpoint": "https://login.datalabs.ceh.ac.uk/oauth/token"
       }
     }
   },
diff --git a/code/workspaces/auth-service/src/config/config.js b/code/workspaces/auth-service/src/config/config.js
index 1c37cfca3..8cb36aacd 100644
--- a/code/workspaces/auth-service/src/config/config.js
+++ b/code/workspaces/auth-service/src/config/config.js
@@ -46,7 +46,7 @@ const config = convict({
   oidcProviderDomain: {
     doc: 'URL of the OpenID Connect provider domain',
     format: 'String',
-    default: 'mjbr.eu.auth0.com',
+    default: 'login.datalabs.ceh.ac.uk',
     env: 'OIDC_PROVIDER_DOMAIN',
   },
   oidcProviderAudience: {
diff --git a/code/workspaces/common/src/config/web_auth_config.json b/code/workspaces/common/src/config/web_auth_config.json
index 5c9c8a62e..09d197e81 100644
--- a/code/workspaces/common/src/config/web_auth_config.json
+++ b/code/workspaces/common/src/config/web_auth_config.json
@@ -5,7 +5,7 @@
       "redirect_uri": "https://testlab.datalabs.localhost/callback",
       "response_type": "code",
       "scope": "openid profile",
-      "authority": "https://mjbr.eu.auth0.com",
+      "authority": "https://login.datalabs.ceh.ac.uk",
       "automaticSilentRenew": true,
       "filterProtocolClaims": true,
       "loadUserInfo": true,
@@ -13,12 +13,12 @@
         "audience": "https://datalab.datalabs.nerc.ac.uk/api"
       },
       "metadata": {
-        "issuer": "https://mjbr.eu.auth0.com/",
-        "authorization_endpoint": "https://mjbr.eu.auth0.com/authorize",
-        "userinfo_endpoint": "https://mjbr.eu.auth0.com/userinfo",
-        "end_session_endpoint": "https://mjbr.eu.auth0.com/v2/logout?returnTo=https://testlab.datalabs.localhost/&client_id=Xf62MEzjqxfaId1DVWnFul61D9oA3eMt",
-        "jwks_uri": "https://mjbr.eu.auth0.com/.well-known/jwks.json",
-        "token_endpoint": "https://mjbr.eu.auth0.com/oauth/token"
+        "issuer": "https://login.datalabs.ceh.ac.uk/",
+        "authorization_endpoint": "https://login.datalabs.ceh.ac.uk/authorize",
+        "userinfo_endpoint": "https://login.datalabs.ceh.ac.uk/userinfo",
+        "end_session_endpoint": "https://login.datalabs.ceh.ac.uk/v2/logout?returnTo=https://testlab.datalabs.localhost/&client_id=Xf62MEzjqxfaId1DVWnFul61D9oA3eMt",
+        "jwks_uri": "https://login.datalabs.ceh.ac.uk/.well-known/jwks.json",
+        "token_endpoint": "https://login.datalabs.ceh.ac.uk/oauth/token"
       }
     }
   },
diff --git a/code/workspaces/web-app/public/web_auth_config.json b/code/workspaces/web-app/public/web_auth_config.json
index 5c9c8a62e..09d197e81 100644
--- a/code/workspaces/web-app/public/web_auth_config.json
+++ b/code/workspaces/web-app/public/web_auth_config.json
@@ -5,7 +5,7 @@
       "redirect_uri": "https://testlab.datalabs.localhost/callback",
       "response_type": "code",
       "scope": "openid profile",
-      "authority": "https://mjbr.eu.auth0.com",
+      "authority": "https://login.datalabs.ceh.ac.uk",
       "automaticSilentRenew": true,
       "filterProtocolClaims": true,
       "loadUserInfo": true,
@@ -13,12 +13,12 @@
         "audience": "https://datalab.datalabs.nerc.ac.uk/api"
       },
       "metadata": {
-        "issuer": "https://mjbr.eu.auth0.com/",
-        "authorization_endpoint": "https://mjbr.eu.auth0.com/authorize",
-        "userinfo_endpoint": "https://mjbr.eu.auth0.com/userinfo",
-        "end_session_endpoint": "https://mjbr.eu.auth0.com/v2/logout?returnTo=https://testlab.datalabs.localhost/&client_id=Xf62MEzjqxfaId1DVWnFul61D9oA3eMt",
-        "jwks_uri": "https://mjbr.eu.auth0.com/.well-known/jwks.json",
-        "token_endpoint": "https://mjbr.eu.auth0.com/oauth/token"
+        "issuer": "https://login.datalabs.ceh.ac.uk/",
+        "authorization_endpoint": "https://login.datalabs.ceh.ac.uk/authorize",
+        "userinfo_endpoint": "https://login.datalabs.ceh.ac.uk/userinfo",
+        "end_session_endpoint": "https://login.datalabs.ceh.ac.uk/v2/logout?returnTo=https://testlab.datalabs.localhost/&client_id=Xf62MEzjqxfaId1DVWnFul61D9oA3eMt",
+        "jwks_uri": "https://login.datalabs.ceh.ac.uk/.well-known/jwks.json",
+        "token_endpoint": "https://login.datalabs.ceh.ac.uk/oauth/token"
       }
     }
   },

From 0b65e7d17cf89283db4e3ac3168b2f3284b34616 Mon Sep 17 00:00:00 2001
From: "Oladimeji S. Awe" <olaawe@ceh.ac.uk>
Date: Wed, 15 Nov 2023 16:49:36 +0000
Subject: [PATCH 2/2] chore: updating the snapshots for auth-service and web
 app

---
 .../config/__snapshots__/oidcConfig.spec.js.snap   |  6 +++---
 .../src/config/__snapshots__/auth.spec.js.snap     | 14 +++++++-------
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/code/workspaces/auth-service/src/config/__snapshots__/oidcConfig.spec.js.snap b/code/workspaces/auth-service/src/config/__snapshots__/oidcConfig.spec.js.snap
index 71d71d12d..3d2f7d6ea 100644
--- a/code/workspaces/auth-service/src/config/__snapshots__/oidcConfig.spec.js.snap
+++ b/code/workspaces/auth-service/src/config/__snapshots__/oidcConfig.spec.js.snap
@@ -2,8 +2,8 @@
 
 exports[`getOidcConfig returns config from environment to match snapshot when configuration endpoint requests fail 1`] = `
 Object {
-  "issuer": "https://mjbr.eu.auth0.com/",
-  "jwks_uri": "https://mjbr.eu.auth0.com/.well-known/jwks.json",
-  "token_endpoint": "https://mjbr.eu.auth0.com/oauth/token",
+  "issuer": "https://login.datalabs.ceh.ac.uk/",
+  "jwks_uri": "https://login.datalabs.ceh.ac.uk/.well-known/jwks.json",
+  "token_endpoint": "https://login.datalabs.ceh.ac.uk/oauth/token",
 }
 `;
diff --git a/code/workspaces/web-app/src/config/__snapshots__/auth.spec.js.snap b/code/workspaces/web-app/src/config/__snapshots__/auth.spec.js.snap
index d15e67bf2..4735b93b8 100644
--- a/code/workspaces/web-app/src/config/__snapshots__/auth.spec.js.snap
+++ b/code/workspaces/web-app/src/config/__snapshots__/auth.spec.js.snap
@@ -4,7 +4,7 @@ exports[`auth returns correct configuration 1`] = `
 Object {
   "oidc": Object {
     "userManager": Object {
-      "authority": "https://mjbr.eu.auth0.com",
+      "authority": "https://login.datalabs.ceh.ac.uk",
       "automaticSilentRenew": true,
       "client_id": "Xf62MEzjqxfaId1DVWnFul61D9oA3eMt",
       "extraQueryParams": Object {
@@ -13,12 +13,12 @@ Object {
       "filterProtocolClaims": true,
       "loadUserInfo": true,
       "metadata": Object {
-        "authorization_endpoint": "https://mjbr.eu.auth0.com/authorize",
-        "end_session_endpoint": "https://mjbr.eu.auth0.com/v2/logout?returnTo=https://testlab.datalabs.localhost/&client_id=Xf62MEzjqxfaId1DVWnFul61D9oA3eMt",
-        "issuer": "https://mjbr.eu.auth0.com/",
-        "jwks_uri": "https://mjbr.eu.auth0.com/.well-known/jwks.json",
-        "token_endpoint": "https://mjbr.eu.auth0.com/oauth/token",
-        "userinfo_endpoint": "https://mjbr.eu.auth0.com/userinfo",
+        "authorization_endpoint": "https://login.datalabs.ceh.ac.uk/authorize",
+        "end_session_endpoint": "https://login.datalabs.ceh.ac.uk/v2/logout?returnTo=https://testlab.datalabs.localhost/&client_id=Xf62MEzjqxfaId1DVWnFul61D9oA3eMt",
+        "issuer": "https://login.datalabs.ceh.ac.uk/",
+        "jwks_uri": "https://login.datalabs.ceh.ac.uk/.well-known/jwks.json",
+        "token_endpoint": "https://login.datalabs.ceh.ac.uk/oauth/token",
+        "userinfo_endpoint": "https://login.datalabs.ceh.ac.uk/userinfo",
       },
       "redirect_uri": "http://localhost/callback",
       "response_type": "code",