From 39deb6b75b01928c3ebe810eb66d65f6c4fd745e Mon Sep 17 00:00:00 2001 From: GurukiranP Date: Wed, 22 May 2024 17:07:34 +0530 Subject: [PATCH 1/3] [ES-675] Temporary code change for testing L2 flow. Signed-off-by: GurukiranP --- oidc-ui/src/components/ConsentDetails.js | 45 +++++++++++++----------- oidc-ui/src/components/Pin.js | 32 +++++++++++------ 2 files changed, 45 insertions(+), 32 deletions(-) diff --git a/oidc-ui/src/components/ConsentDetails.js b/oidc-ui/src/components/ConsentDetails.js index 33cc77e9b..c092fdc5e 100644 --- a/oidc-ui/src/components/ConsentDetails.js +++ b/oidc-ui/src/components/ConsentDetails.js @@ -55,7 +55,7 @@ const ConsentDetails = ({ const { response, errors } = consentDetailsResponse; if (errors != null && errors.length > 0) { - redirectOnError(errors[0].errorCode, t2(`${errors[0].errorCode}`)); + // redirectOnError(errors[0].errorCode, t2(`${errors[0].errorCode}`)); return; } else { let claimsScopes = []; @@ -131,7 +131,7 @@ const ConsentDetails = ({ setClaimsScopes(claimsScopes); } } catch (error) { - redirectOnError("authorization_failed_msg", error.message); + // redirectOnError("authorization_failed_msg", error.message); } }; @@ -141,25 +141,28 @@ const ConsentDetails = ({ const handleProceed = async () => { window.onbeforeunload = null; - try { - const signupRedirectResponse = await authServices.prepareSignupRedirect( - transactionId, - window.location.href - ); - const { response, errors } = signupRedirectResponse; - - if (errors != null && errors.length > 0) { - redirectOnError(errors[0].errorCode, t2(`${errors[0].errorCode}`)); - return; - } else { - const encodedIdToken = btoa(response.idToken); - window.location.replace( - `${eKYCStepsURL}?state=${state}#${encodedIdToken}` + window.location.replace( + `${eKYCStepsURL}?state=${state}#id_token` ); - } - } catch (error) { - redirectOnError("authorization_failed_msg", error.message); - } + // try { + // const signupRedirectResponse = await authServices.prepareSignupRedirect( + // transactionId, + // window.location.href + // ); + // const { response, errors } = signupRedirectResponse; + + // if (errors != null && errors.length > 0) { + // redirectOnError(errors[0].errorCode, t2(`${errors[0].errorCode}`)); + // return; + // } else { + // const encodedIdToken = btoa(response.idToken); + // window.location.replace( + // `${eKYCStepsURL}?state=${state}#${encodedIdToken}` + // ); + // } + // } catch (error) { + // redirectOnError("authorization_failed_msg", error.message); + // } }; const handleCancel = () => { @@ -277,7 +280,7 @@ const ConsentDetails = ({ content={claimScope.tooltip} position="bottom" contentSize="text-xs" - contentClassName="rounded-md px-3 py-2 border border-[#BCBCBC] outline-0 bg-white shadow-md z-50 w-screen sm:w-[26rem] leading-none" + contentClassName="rounded-md px-3 py-2 border border-[#BCBCBC] outline-0 bg-white shadow-md z-50 w-screen sm:w-[26rem] leading-none abc" /> diff --git a/oidc-ui/src/components/Pin.js b/oidc-ui/src/components/Pin.js index c0128735f..ccb4f4b63 100644 --- a/oidc-ui/src/components/Pin.js +++ b/oidc-ui/src/components/Pin.js @@ -97,6 +97,16 @@ export default function Pin({ ); setStatus(states.LOADED); + let nonce = openIDConnectService.getNonce(); + let state = openIDConnectService.getState(); + let params = buildRedirectParams( + nonce, + state, + openIDConnectService.getOAuthDetails() + ); + navigate(process.env.PUBLIC_URL + "/claims-details" + params, { + replace: true, + }); const { response, errors } = authenticateResponse; @@ -123,15 +133,15 @@ export default function Pin({ } else { setErrorBanner(null); - let nonce = openIDConnectService.getNonce(); - let state = openIDConnectService.getState(); + // let nonce = openIDConnectService.getNonce(); + // let state = openIDConnectService.getState(); - let params = buildRedirectParams( - nonce, - state, - openIDConnectService.getOAuthDetails(), - response.consentAction - ); + // let params = buildRedirectParams( + // nonce, + // state, + // openIDConnectService.getOAuthDetails(), + // response.consentAction + // ); //TODO navigate to specific url based on the response @@ -139,9 +149,9 @@ export default function Pin({ // replace: true, // }); - navigate(process.env.PUBLIC_URL + "/claims-details" + params, { - replace: true, - }); + // navigate(process.env.PUBLIC_URL + "/claims-details" + params, { + // replace: true, + // }); } } catch (error) { setErrorBanner({ From 27dc0841ebc6a17115c846ae405f9bf47488e276 Mon Sep 17 00:00:00 2001 From: GurukiranP Date: Wed, 22 May 2024 17:09:00 +0530 Subject: [PATCH 2/3] [ES-675] Temporary code change for testing L2 flow. Signed-off-by: GurukiranP --- oidc-ui/src/components/ConsentDetails.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oidc-ui/src/components/ConsentDetails.js b/oidc-ui/src/components/ConsentDetails.js index c092fdc5e..0ff5e3fbf 100644 --- a/oidc-ui/src/components/ConsentDetails.js +++ b/oidc-ui/src/components/ConsentDetails.js @@ -280,7 +280,7 @@ const ConsentDetails = ({ content={claimScope.tooltip} position="bottom" contentSize="text-xs" - contentClassName="rounded-md px-3 py-2 border border-[#BCBCBC] outline-0 bg-white shadow-md z-50 w-screen sm:w-[26rem] leading-none abc" + contentClassName="rounded-md px-3 py-2 border border-[#BCBCBC] outline-0 bg-white shadow-md z-50 w-screen sm:w-[26rem] leading-none" /> From 5489d27a7b0060d57c9dd77837c8c26a9293f579 Mon Sep 17 00:00:00 2001 From: GurukiranP Date: Thu, 23 May 2024 11:29:55 +0530 Subject: [PATCH 3/3] [ES-675] Reverted the temporary code. Signed-off-by: GurukiranP --- oidc-ui/src/components/ConsentDetails.js | 44 +++++++++++------------- oidc-ui/src/components/Pin.js | 33 ++++++------------ 2 files changed, 32 insertions(+), 45 deletions(-) diff --git a/oidc-ui/src/components/ConsentDetails.js b/oidc-ui/src/components/ConsentDetails.js index 0ff5e3fbf..f79c76e53 100644 --- a/oidc-ui/src/components/ConsentDetails.js +++ b/oidc-ui/src/components/ConsentDetails.js @@ -55,7 +55,7 @@ const ConsentDetails = ({ const { response, errors } = consentDetailsResponse; if (errors != null && errors.length > 0) { - // redirectOnError(errors[0].errorCode, t2(`${errors[0].errorCode}`)); + redirectOnError(errors[0].errorCode, t2(`${errors[0].errorCode}`)); return; } else { let claimsScopes = []; @@ -131,7 +131,7 @@ const ConsentDetails = ({ setClaimsScopes(claimsScopes); } } catch (error) { - // redirectOnError("authorization_failed_msg", error.message); + redirectOnError("authorization_failed_msg", error.message); } }; @@ -141,28 +141,26 @@ const ConsentDetails = ({ const handleProceed = async () => { window.onbeforeunload = null; - window.location.replace( - `${eKYCStepsURL}?state=${state}#id_token` - ); - // try { - // const signupRedirectResponse = await authServices.prepareSignupRedirect( - // transactionId, - // window.location.href - // ); - // const { response, errors } = signupRedirectResponse; + + try { + const signupRedirectResponse = await authServices.prepareSignupRedirect( + transactionId, + window.location.href + ); + const { response, errors } = signupRedirectResponse; - // if (errors != null && errors.length > 0) { - // redirectOnError(errors[0].errorCode, t2(`${errors[0].errorCode}`)); - // return; - // } else { - // const encodedIdToken = btoa(response.idToken); - // window.location.replace( - // `${eKYCStepsURL}?state=${state}#${encodedIdToken}` - // ); - // } - // } catch (error) { - // redirectOnError("authorization_failed_msg", error.message); - // } + if (errors != null && errors.length > 0) { + redirectOnError(errors[0].errorCode, t2(`${errors[0].errorCode}`)); + return; + } else { + const encodedIdToken = btoa(response.idToken); + window.location.replace( + `${eKYCStepsURL}?state=${state}#${encodedIdToken}` + ); + } + } catch (error) { + redirectOnError("authorization_failed_msg", error.message); + } }; const handleCancel = () => { diff --git a/oidc-ui/src/components/Pin.js b/oidc-ui/src/components/Pin.js index ccb4f4b63..e9a52a7d2 100644 --- a/oidc-ui/src/components/Pin.js +++ b/oidc-ui/src/components/Pin.js @@ -97,16 +97,6 @@ export default function Pin({ ); setStatus(states.LOADED); - let nonce = openIDConnectService.getNonce(); - let state = openIDConnectService.getState(); - let params = buildRedirectParams( - nonce, - state, - openIDConnectService.getOAuthDetails() - ); - navigate(process.env.PUBLIC_URL + "/claims-details" + params, { - replace: true, - }); const { response, errors } = authenticateResponse; @@ -133,25 +123,24 @@ export default function Pin({ } else { setErrorBanner(null); - // let nonce = openIDConnectService.getNonce(); - // let state = openIDConnectService.getState(); - - // let params = buildRedirectParams( - // nonce, - // state, - // openIDConnectService.getOAuthDetails(), - // response.consentAction - // ); + let nonce = openIDConnectService.getNonce(); + let state = openIDConnectService.getState(); + let params = buildRedirectParams( + nonce, + state, + openIDConnectService.getOAuthDetails(), + response.consentAction + ); //TODO navigate to specific url based on the response // navigate(process.env.PUBLIC_URL + "/consent" + params, { // replace: true, // }); - // navigate(process.env.PUBLIC_URL + "/claims-details" + params, { - // replace: true, - // }); + navigate(process.env.PUBLIC_URL + "/claims-details" + params, { + replace: true, + }); } } catch (error) { setErrorBanner({