From 836e45dada05261f2fbb570c63cfe8c2d1837308 Mon Sep 17 00:00:00 2001 From: Kumuditha - KD Date: Wed, 8 Jan 2025 10:00:26 +0530 Subject: [PATCH 1/3] Refactor callback validation logic --- .../main/webapp/self-registration-username-request.jsp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/identity-apps-core/apps/recovery-portal/src/main/webapp/self-registration-username-request.jsp b/identity-apps-core/apps/recovery-portal/src/main/webapp/self-registration-username-request.jsp index e1771e7a411..6bb5f57ba3e 100644 --- a/identity-apps-core/apps/recovery-portal/src/main/webapp/self-registration-username-request.jsp +++ b/identity-apps-core/apps/recovery-portal/src/main/webapp/self-registration-username-request.jsp @@ -307,6 +307,11 @@ consentPurposeGroupName = "JIT"; } + if (StringUtils.isBlank(callback) || StringUtils.equalsIgnoreCase(callback, "null")) { + callback = Encode.forHtmlAttribute(IdentityManagementEndpointUtil.getUserPortalUrl( + application.getInitParameter(IdentityManagementEndpointConstants.ConfigConstants.USER_PORTAL_URL), tenantDomain)); + } + try { if (StringUtils.isNotBlank(callback) && !Utils.validateCallbackURL(callback, tenantDomain, IdentityRecoveryConstants.ConnectorConfig.SELF_REGISTRATION_CALLBACK_REGEX)) { @@ -323,11 +328,6 @@ return; } - if (StringUtils.isBlank(callback) || StringUtils.equalsIgnoreCase(callback, "null")) { - callback = Encode.forHtmlAttribute(IdentityManagementEndpointUtil.getUserPortalUrl( - application.getInitParameter(IdentityManagementEndpointConstants.ConfigConstants.USER_PORTAL_URL), tenantDomain)); - } - /** * If backToUrl is null get to access url of the application. */ From db0b11a3ddb3497a07199e71cbdf41edcb950f9f Mon Sep 17 00:00:00 2001 From: Kumuditha - KD Date: Wed, 8 Jan 2025 10:30:51 +0530 Subject: [PATCH 2/3] Revert callback validation logic --- .../self-registration-username-request.jsp | 21 +------------------ 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/identity-apps-core/apps/recovery-portal/src/main/webapp/self-registration-username-request.jsp b/identity-apps-core/apps/recovery-portal/src/main/webapp/self-registration-username-request.jsp index 6bb5f57ba3e..a6f62cc58e8 100644 --- a/identity-apps-core/apps/recovery-portal/src/main/webapp/self-registration-username-request.jsp +++ b/identity-apps-core/apps/recovery-portal/src/main/webapp/self-registration-username-request.jsp @@ -27,9 +27,6 @@ <%@ page import="org.wso2.carbon.identity.application.authentication.endpoint.util.AuthenticationEndpointUtil" %> <%@ page import="static org.wso2.carbon.identity.application.authentication.endpoint.util.Constants.STATUS" %> <%@ page import="static org.wso2.carbon.identity.application.authentication.endpoint.util.Constants.STATUS_MSG" %> -<%@ page import="org.wso2.carbon.identity.recovery.IdentityRecoveryConstants" %> -<%@ page import="org.wso2.carbon.identity.recovery.util.Utils" %> -<%@ page import="org.wso2.carbon.identity.base.IdentityRuntimeException" %> <%@ page import="org.wso2.carbon.identity.application.authentication.endpoint.util.Constants" %> <%@ page import="org.wso2.carbon.identity.captcha.util.CaptchaUtil" %> <%@ page import="org.wso2.carbon.identity.core.URLBuilderException" %> @@ -312,22 +309,6 @@ application.getInitParameter(IdentityManagementEndpointConstants.ConfigConstants.USER_PORTAL_URL), tenantDomain)); } - try { - if (StringUtils.isNotBlank(callback) && !Utils.validateCallbackURL(callback, tenantDomain, - IdentityRecoveryConstants.ConnectorConfig.SELF_REGISTRATION_CALLBACK_REGEX)) { - request.setAttribute("error", true); - request.setAttribute("errorMsg", IdentityManagementEndpointUtil.i18n(recoveryResourceBundle, - "Callback.url.format.invalid")); - request.getRequestDispatcher("error.jsp").forward(request, response); - return; - } - } catch (IdentityRuntimeException e) { - request.setAttribute("error", true); - request.setAttribute("errorMsg", e.getMessage()); - request.getRequestDispatcher("error.jsp").forward(request, response); - return; - } - /** * If backToUrl is null get to access url of the application. */ @@ -762,7 +743,7 @@ From 298b6e44edc672ba9486e87ca8cab515ce37c880 Mon Sep 17 00:00:00 2001 From: Kumuditha - KD Date: Wed, 8 Jan 2025 10:56:19 +0530 Subject: [PATCH 3/3] =?UTF-8?q?Add=20changeset=20=F0=9F=A6=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .changeset/short-grapes-attack.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/short-grapes-attack.md diff --git a/.changeset/short-grapes-attack.md b/.changeset/short-grapes-attack.md new file mode 100644 index 00000000000..96d3ed1d0c9 --- /dev/null +++ b/.changeset/short-grapes-attack.md @@ -0,0 +1,5 @@ +--- +"@wso2is/identity-apps-core": major +--- + +Revert callback validation logic