From 514271a05ae577ff517a1d0b338e578c5390a422 Mon Sep 17 00:00:00 2001 From: Sachin Maheshwari Date: Thu, 28 Apr 2022 17:17:56 +0530 Subject: [PATCH 1/5] Plat-960, block sign-in for wipro contractor --- web-assets/auth0/dev-tenant/rules/custom.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/web-assets/auth0/dev-tenant/rules/custom.js b/web-assets/auth0/dev-tenant/rules/custom.js index 640bd55..ceda292 100644 --- a/web-assets/auth0/dev-tenant/rules/custom.js +++ b/web-assets/auth0/dev-tenant/rules/custom.js @@ -19,7 +19,6 @@ function (user, context, callback) { handle = _.get(user, "nickname", null); } console.log("Fetch roles for email/handle: ", user.email, handle, provider); - global.AUTH0_CLAIM_NAMESPACE = "https://" + configuration.DOMAIN + "/"; try { request.post({ @@ -47,6 +46,12 @@ function (user, context, callback) { // TEMP let tcsso = res.result.content.regSource || ''; + // block wipro/topgear contractor user + const topgearBlockMessage = "Topgear can be accessed only by Wipro Employees. If you are a Wipro employee and not able to access, drop an email to ask.topgear@wipro.com with the error message"; + if (roles.indexOf(configuration.TOPGEAR_CONTRACTOR_ROLE) > -1) { + return callback(topgearBlockMessage, user, context); + } + context.idToken[global.AUTH0_CLAIM_NAMESPACE + 'roles'] = roles; context.idToken[global.AUTH0_CLAIM_NAMESPACE + 'userId'] = userId; context.idToken[global.AUTH0_CLAIM_NAMESPACE + 'handle'] = handle; From 8a5af0b59a4e23374cc500d09ae94b371a2bc627 Mon Sep 17 00:00:00 2001 From: Sachin Maheshwari Date: Fri, 29 Apr 2022 17:07:30 +0530 Subject: [PATCH 2/5] parsing html in alert message --- web-assets/auth0/dev-tenant/rules/custom.js | 2 +- web-assets/js/setupAuth0WithRedirect.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/web-assets/auth0/dev-tenant/rules/custom.js b/web-assets/auth0/dev-tenant/rules/custom.js index ceda292..8cc7a4d 100644 --- a/web-assets/auth0/dev-tenant/rules/custom.js +++ b/web-assets/auth0/dev-tenant/rules/custom.js @@ -47,7 +47,7 @@ function (user, context, callback) { let tcsso = res.result.content.regSource || ''; // block wipro/topgear contractor user - const topgearBlockMessage = "Topgear can be accessed only by Wipro Employees. If you are a Wipro employee and not able to access, drop an email to ask.topgear@wipro.com with the error message"; + const topgearBlockMessage = 'Topgear can be accessed only by Wipro Employees. If you are a Wipro employee and not able to access, drop an email to ask.topgear@wipro.com with the error message'; if (roles.indexOf(configuration.TOPGEAR_CONTRACTOR_ROLE) > -1) { return callback(topgearBlockMessage, user, context); } diff --git a/web-assets/js/setupAuth0WithRedirect.js b/web-assets/js/setupAuth0WithRedirect.js index b5cd6a4..78b99e3 100644 --- a/web-assets/js/setupAuth0WithRedirect.js +++ b/web-assets/js/setupAuth0WithRedirect.js @@ -634,9 +634,9 @@ const authSetup = function () { function showLoginError(message, linkUrl) { try { document.getElementById("page-title-heading").innerText = "Alert"; - var messageElement = document.createElement("span"); - messageElement.appendChild(document.createTextNode(message)); - document.getElementById("loading_message_p").innerHTML = messageElement.innerText + " click here"; + //var messageElement = document.createElement("span"); + //messageElement.appendChild(document.createTextNode(message)); + document.getElementById("loading_message_p").innerHTML = message + " click here"; } catch (err) { logger("Error in changing loading message: ", err.message) } From 5c1fec3fd45074107287284d51512477e1bec711 Mon Sep 17 00:00:00 2001 From: Sachin Maheshwari Date: Fri, 29 Apr 2022 17:11:18 +0530 Subject: [PATCH 3/5] correcting error message --- web-assets/auth0/dev-tenant/rules/custom.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web-assets/auth0/dev-tenant/rules/custom.js b/web-assets/auth0/dev-tenant/rules/custom.js index 8cc7a4d..a24a335 100644 --- a/web-assets/auth0/dev-tenant/rules/custom.js +++ b/web-assets/auth0/dev-tenant/rules/custom.js @@ -47,7 +47,7 @@ function (user, context, callback) { let tcsso = res.result.content.regSource || ''; // block wipro/topgear contractor user - const topgearBlockMessage = 'Topgear can be accessed only by Wipro Employees. If you are a Wipro employee and not able to access, drop an email to ask.topgear@wipro.com with the error message'; + const topgearBlockMessage = 'Topgear can be accessed only by Wipro Employees. If you are a Wipro employee and not able to access, drop an email to ask.topgear@wipro.com with the error message.Back to application '; if (roles.indexOf(configuration.TOPGEAR_CONTRACTOR_ROLE) > -1) { return callback(topgearBlockMessage, user, context); } From 61e0a0b36c3a12794c4c54180a0df676d418b098 Mon Sep 17 00:00:00 2001 From: Sachin Maheshwari Date: Fri, 29 Apr 2022 17:34:21 +0530 Subject: [PATCH 4/5] correcting html formatting --- web-assets/js/setupAuth0WithRedirect.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/web-assets/js/setupAuth0WithRedirect.js b/web-assets/js/setupAuth0WithRedirect.js index 78b99e3..f24179e 100644 --- a/web-assets/js/setupAuth0WithRedirect.js +++ b/web-assets/js/setupAuth0WithRedirect.js @@ -634,9 +634,9 @@ const authSetup = function () { function showLoginError(message, linkUrl) { try { document.getElementById("page-title-heading").innerText = "Alert"; - //var messageElement = document.createElement("span"); - //messageElement.appendChild(document.createTextNode(message)); - document.getElementById("loading_message_p").innerHTML = message + " click here"; + var messageElement = document.createElement("textarea"); + messageElement.innerHTML = message; + document.getElementById("loading_message_p").innerHTML = messageElement.value + " click here"; } catch (err) { logger("Error in changing loading message: ", err.message) } From 870b7fa73e6015888828eec67293a38274ef156a Mon Sep 17 00:00:00 2001 From: Sachin Maheshwari Date: Thu, 5 May 2022 10:37:32 +0530 Subject: [PATCH 5/5] Plat-960 --- web-assets/auth0/prod-tenant/rules/custom.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/web-assets/auth0/prod-tenant/rules/custom.js b/web-assets/auth0/prod-tenant/rules/custom.js index da512c4..e51dd7a 100644 --- a/web-assets/auth0/prod-tenant/rules/custom.js +++ b/web-assets/auth0/prod-tenant/rules/custom.js @@ -42,6 +42,12 @@ function (user, context, callback) { // TEMP let tcsso = res.result.content.regSource || ''; + // block wipro/topgear contractor user + const topgearBlockMessage = 'Topgear can be accessed only by Wipro Employees. If you are a Wipro employee and not able to access, drop an email to ask.topgear@wipro.com with the error message.Back to application '; + if (roles.indexOf(configuration.TOPGEAR_CONTRACTOR_ROLE) > -1) { + return callback(topgearBlockMessage, user, context); + } + context.idToken[global.AUTH0_CLAIM_NAMESPACE + 'roles'] = roles; context.idToken[global.AUTH0_CLAIM_NAMESPACE + 'userId'] = userId; context.idToken[global.AUTH0_CLAIM_NAMESPACE + 'handle'] = handle;