From 47d530a7d22d2b4902a062e342b3bfe4bb7dc086 Mon Sep 17 00:00:00 2001 From: Rashmini Date: Wed, 11 Oct 2023 16:04:32 +0530 Subject: [PATCH 1/4] Update recovery portal to v2 --- .../webapp/password-recovery-with-claims-options.jsp | 10 +++++----- .../apps/recovery-portal/src/main/webapp/recovery.jsp | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/identity-apps-core/apps/recovery-portal/src/main/webapp/password-recovery-with-claims-options.jsp b/identity-apps-core/apps/recovery-portal/src/main/webapp/password-recovery-with-claims-options.jsp index 8414c461bd5..f4690980434 100644 --- a/identity-apps-core/apps/recovery-portal/src/main/webapp/password-recovery-with-claims-options.jsp +++ b/identity-apps-core/apps/recovery-portal/src/main/webapp/password-recovery-with-claims-options.jsp @@ -26,8 +26,8 @@ <%@ page import="java.util.ArrayList" %> <%@ page import="java.util.List" %> <%@ page import="java.util.Map" %> -<%@ page import="org.wso2.carbon.identity.mgt.endpoint.util.client.api.PasswordRecoveryApiV1" %> -<%@ page import="org.wso2.carbon.identity.mgt.endpoint.util.client.model.passwordrecovery.v1.*" %> +<%@ page import="org.wso2.carbon.identity.mgt.endpoint.util.client.api.PasswordRecoveryApiV2" %> +<%@ page import="org.wso2.carbon.identity.mgt.endpoint.util.client.model.passwordrecovery.v2.*" %> <%@ page import="org.wso2.carbon.identity.mgt.endpoint.util.client.api.UsernameRecoveryApi" %> <%@ page import="org.wso2.carbon.identity.mgt.endpoint.util.client.model.*" %> <%@ page import="org.wso2.carbon.identity.mgt.endpoint.util.IdentityManagementEndpointConstants" %> @@ -93,13 +93,13 @@ RecoveryInitRequest recoveryInitRequest = new RecoveryInitRequest(); recoveryInitRequest.setClaims(claimDTOList); - PasswordRecoveryApiV1 passwordRecoveryApiV1 = new PasswordRecoveryApiV1(); + PasswordRecoveryApiV2 passwordRecoveryApiV2 = new PasswordRecoveryApiV2(); try { Map requestHeaders = new HashedMap(); if (recaptchaResponse != null) { requestHeaders.put("g-recaptcha-response", recaptchaResponse); } - List accountRecoveryTypes = passwordRecoveryApiV1. + List accountRecoveryTypes = passwordRecoveryApiV2. initiatePasswordRecovery(recoveryInitRequest, tenantDomain, requestHeaders); if (accountRecoveryTypes == null) { request.setAttribute("callback", callback); @@ -108,7 +108,7 @@ response); return; } - IdentityManagementEndpointUtil.addReCaptchaHeaders(request, passwordRecoveryApiV1.getApiClient().getResponseHeaders()); + IdentityManagementEndpointUtil.addReCaptchaHeaders(request, passwordRecoveryApiV2.getApiClient().getResponseHeaders()); for (AccountRecoveryType accountRecoveryType : accountRecoveryTypes) { if (accountRecoveryType.getMode().equals("recoverWithNotifications")) { isNotificationBasedRecoveryEnabled = true; diff --git a/identity-apps-core/apps/recovery-portal/src/main/webapp/recovery.jsp b/identity-apps-core/apps/recovery-portal/src/main/webapp/recovery.jsp index 7692791aff3..78d25683845 100644 --- a/identity-apps-core/apps/recovery-portal/src/main/webapp/recovery.jsp +++ b/identity-apps-core/apps/recovery-portal/src/main/webapp/recovery.jsp @@ -25,7 +25,7 @@ <%@ page import="org.wso2.carbon.identity.mgt.endpoint.util.IdentityManagementEndpointUtil" %> <%@ page import="org.wso2.carbon.identity.mgt.endpoint.util.client.ApiException" %> <%@ page import="org.wso2.carbon.identity.mgt.endpoint.util.client.api.UsernameRecoveryApi" %> -<%@ page import="org.wso2.carbon.identity.mgt.endpoint.util.client.api.PasswordRecoveryApiV1" %> +<%@ page import="org.wso2.carbon.identity.mgt.endpoint.util.client.api.PasswordRecoveryApiV2" %> <%@ page import="org.wso2.carbon.identity.mgt.endpoint.util.client.model.Claim" %> <%@ page import="org.wso2.carbon.identity.mgt.endpoint.util.client.model.UserClaim" %> <%@ page import="org.wso2.carbon.user.core.util.UserCoreUtil" %> @@ -35,7 +35,7 @@ <%@ page import="java.util.Map" %> <%@ page import="org.wso2.carbon.identity.mgt.endpoint.util.client.model.Property" %> <%@ page import="java.net.URLEncoder" %> -<%@ page import="org.wso2.carbon.identity.mgt.endpoint.util.client.model.passwordrecovery.v1.*" %> +<%@ page import="org.wso2.carbon.identity.mgt.endpoint.util.client.model.passwordrecovery.v2.*" %> <%@ page import="org.wso2.carbon.identity.mgt.endpoint.util.client.PreferenceRetrievalClient" %> <%@ page import="org.wso2.carbon.identity.mgt.endpoint.util.client.PreferenceRetrievalClientException" %> @@ -165,14 +165,14 @@ String recoveryCode = request.getParameter("recoveryCode"); String notificationChannel = ""; - PasswordRecoveryApiV1 passwordRecoveryApiV1 = new PasswordRecoveryApiV1(); + PasswordRecoveryApiV2 passwordRecoveryApiV2 = new PasswordRecoveryApiV2(); if (recoveryOption.equals("SECURITY_QUESTIONS")) { username = IdentityManagementEndpointUtil.getFullQualifiedUsername(username, tenantDomain, null); request.setAttribute("callback", callback); request.setAttribute("sessionDataKey", sessionDataKey); request.setAttribute("username", username); session.setAttribute("username", username); - IdentityManagementEndpointUtil.addReCaptchaHeaders(request, passwordRecoveryApiV1. + IdentityManagementEndpointUtil.addReCaptchaHeaders(request, passwordRecoveryApiV2. getApiClient().getResponseHeaders()); request.getRequestDispatcher("challenge-question-request.jsp?username=" + username).forward(request, response); @@ -195,7 +195,7 @@ recoveryRequest.setRecoveryCode(recoveryCode); try { Map requestHeaders = new HashedMap(); - RecoveryResponse recoveryResponse = passwordRecoveryApiV1.recoverPassword(recoveryRequest, + RecoveryResponse recoveryResponse = passwordRecoveryApiV2.recoverPassword(recoveryRequest, tenantDomain, requestHeaders); notificationChannel = recoveryResponse.getNotificationChannel(); request.setAttribute("callback", callback); From d11175a8d880f7a9941ff098ec41cec63c8ae9ab Mon Sep 17 00:00:00 2001 From: Rashmini Date: Sun, 15 Oct 2023 17:36:09 +0530 Subject: [PATCH 2/4] Update file names --- .../webapp/password-recovery-with-claims-options.jsp | 10 +++++----- .../apps/recovery-portal/src/main/webapp/recovery.jsp | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/identity-apps-core/apps/recovery-portal/src/main/webapp/password-recovery-with-claims-options.jsp b/identity-apps-core/apps/recovery-portal/src/main/webapp/password-recovery-with-claims-options.jsp index f4690980434..89c2f8cac16 100644 --- a/identity-apps-core/apps/recovery-portal/src/main/webapp/password-recovery-with-claims-options.jsp +++ b/identity-apps-core/apps/recovery-portal/src/main/webapp/password-recovery-with-claims-options.jsp @@ -26,8 +26,8 @@ <%@ page import="java.util.ArrayList" %> <%@ page import="java.util.List" %> <%@ page import="java.util.Map" %> -<%@ page import="org.wso2.carbon.identity.mgt.endpoint.util.client.api.PasswordRecoveryApiV2" %> -<%@ page import="org.wso2.carbon.identity.mgt.endpoint.util.client.model.passwordrecovery.v2.*" %> +<%@ page import="org.wso2.carbon.identity.mgt.endpoint.util.client.api.RecoveryApiV2" %> +<%@ page import="org.wso2.carbon.identity.mgt.endpoint.util.client.model.recovery.v2.*" %> <%@ page import="org.wso2.carbon.identity.mgt.endpoint.util.client.api.UsernameRecoveryApi" %> <%@ page import="org.wso2.carbon.identity.mgt.endpoint.util.client.model.*" %> <%@ page import="org.wso2.carbon.identity.mgt.endpoint.util.IdentityManagementEndpointConstants" %> @@ -93,13 +93,13 @@ RecoveryInitRequest recoveryInitRequest = new RecoveryInitRequest(); recoveryInitRequest.setClaims(claimDTOList); - PasswordRecoveryApiV2 passwordRecoveryApiV2 = new PasswordRecoveryApiV2(); + RecoveryApiV2 recoveryApiV2 = new RecoveryApiV2(); try { Map requestHeaders = new HashedMap(); if (recaptchaResponse != null) { requestHeaders.put("g-recaptcha-response", recaptchaResponse); } - List accountRecoveryTypes = passwordRecoveryApiV2. + List accountRecoveryTypes = recoveryApiV2. initiatePasswordRecovery(recoveryInitRequest, tenantDomain, requestHeaders); if (accountRecoveryTypes == null) { request.setAttribute("callback", callback); @@ -108,7 +108,7 @@ response); return; } - IdentityManagementEndpointUtil.addReCaptchaHeaders(request, passwordRecoveryApiV2.getApiClient().getResponseHeaders()); + IdentityManagementEndpointUtil.addReCaptchaHeaders(request, recoveryApiV2.getApiClient().getResponseHeaders()); for (AccountRecoveryType accountRecoveryType : accountRecoveryTypes) { if (accountRecoveryType.getMode().equals("recoverWithNotifications")) { isNotificationBasedRecoveryEnabled = true; diff --git a/identity-apps-core/apps/recovery-portal/src/main/webapp/recovery.jsp b/identity-apps-core/apps/recovery-portal/src/main/webapp/recovery.jsp index 78d25683845..b89e6c9cb06 100644 --- a/identity-apps-core/apps/recovery-portal/src/main/webapp/recovery.jsp +++ b/identity-apps-core/apps/recovery-portal/src/main/webapp/recovery.jsp @@ -25,7 +25,7 @@ <%@ page import="org.wso2.carbon.identity.mgt.endpoint.util.IdentityManagementEndpointUtil" %> <%@ page import="org.wso2.carbon.identity.mgt.endpoint.util.client.ApiException" %> <%@ page import="org.wso2.carbon.identity.mgt.endpoint.util.client.api.UsernameRecoveryApi" %> -<%@ page import="org.wso2.carbon.identity.mgt.endpoint.util.client.api.PasswordRecoveryApiV2" %> +<%@ page import="org.wso2.carbon.identity.mgt.endpoint.util.client.api.RecoveryApiV2" %> <%@ page import="org.wso2.carbon.identity.mgt.endpoint.util.client.model.Claim" %> <%@ page import="org.wso2.carbon.identity.mgt.endpoint.util.client.model.UserClaim" %> <%@ page import="org.wso2.carbon.user.core.util.UserCoreUtil" %> @@ -35,7 +35,7 @@ <%@ page import="java.util.Map" %> <%@ page import="org.wso2.carbon.identity.mgt.endpoint.util.client.model.Property" %> <%@ page import="java.net.URLEncoder" %> -<%@ page import="org.wso2.carbon.identity.mgt.endpoint.util.client.model.passwordrecovery.v2.*" %> +<%@ page import="org.wso2.carbon.identity.mgt.endpoint.util.client.model.recovery.v2.*" %> <%@ page import="org.wso2.carbon.identity.mgt.endpoint.util.client.PreferenceRetrievalClient" %> <%@ page import="org.wso2.carbon.identity.mgt.endpoint.util.client.PreferenceRetrievalClientException" %> @@ -165,14 +165,14 @@ String recoveryCode = request.getParameter("recoveryCode"); String notificationChannel = ""; - PasswordRecoveryApiV2 passwordRecoveryApiV2 = new PasswordRecoveryApiV2(); + RecoveryApiV2 recoveryApiV2 = new RecoveryApiV2(); if (recoveryOption.equals("SECURITY_QUESTIONS")) { username = IdentityManagementEndpointUtil.getFullQualifiedUsername(username, tenantDomain, null); request.setAttribute("callback", callback); request.setAttribute("sessionDataKey", sessionDataKey); request.setAttribute("username", username); session.setAttribute("username", username); - IdentityManagementEndpointUtil.addReCaptchaHeaders(request, passwordRecoveryApiV2. + IdentityManagementEndpointUtil.addReCaptchaHeaders(request, recoveryApiV2. getApiClient().getResponseHeaders()); request.getRequestDispatcher("challenge-question-request.jsp?username=" + username).forward(request, response); @@ -195,7 +195,7 @@ recoveryRequest.setRecoveryCode(recoveryCode); try { Map requestHeaders = new HashedMap(); - RecoveryResponse recoveryResponse = passwordRecoveryApiV2.recoverPassword(recoveryRequest, + RecoveryResponse recoveryResponse = recoveryApiV2.recoverPassword(recoveryRequest, tenantDomain, requestHeaders); notificationChannel = recoveryResponse.getNotificationChannel(); request.setAttribute("callback", callback); From 6c91fce4402d28676faf5bb2b60670760306ff14 Mon Sep 17 00:00:00 2001 From: Rashmini Date: Wed, 18 Oct 2023 12:23:04 +0530 Subject: [PATCH 3/4] Bump framework version --- identity-apps-core/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/identity-apps-core/pom.xml b/identity-apps-core/pom.xml index 8435cc8f0de..12c9cad5cab 100644 --- a/identity-apps-core/pom.xml +++ b/identity-apps-core/pom.xml @@ -673,7 +673,7 @@ 3.0.0 5.1.5 1.0.8 - 5.25.308 + 5.25.402 [5.0.0, 7.0.0] 1.0.0 From 6957fe72b0ae8e942c028f5cd75569b27120bf4c Mon Sep 17 00:00:00 2001 From: Rashmini Date: Wed, 18 Oct 2023 13:41:12 +0530 Subject: [PATCH 4/4] Add changeset --- .changeset/quick-kangaroos-drive.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/quick-kangaroos-drive.md diff --git a/.changeset/quick-kangaroos-drive.md b/.changeset/quick-kangaroos-drive.md new file mode 100644 index 00000000000..7425e70d1c0 --- /dev/null +++ b/.changeset/quick-kangaroos-drive.md @@ -0,0 +1,5 @@ +--- +"@wso2is/identity-apps-core": patch +--- + +Update recovery portal for recovery v2 API