Implement setUserPasswordPost method in Notification API client
@@ -34,6 +34,7 @@ import org.wso2.carbon.identity.mgt.endpoint.util.client.model.CodeValidationReq
import org.wso2.carbon.identity.mgt.endpoint.util.client.model.Property;
import org.wso2.carbon.identity.mgt.endpoint.util.client.model.RecoveryInitiatingRequest;
import org.wso2.carbon.identity.mgt.endpoint.util.client.model.ResetPasswordRequest;
+import org.wso2.carbon.identity.mgt.endpoint.util.client.model.User;
import org.wso2.carbon.identity.mgt.endpoint.util.client.model.UserClaim;
import java.util.ArrayList;
@@ -313,10 +314,67 @@ public class NotificationApi {
}
/**
- * This API is used to validate code of self reigstered users
+ * This API will be used to reset user password using the confirmation key received through recovery process.
*
- * @param code Code retried after user self registration and optional property parameters (required)
- * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
+ * @param resetPasswordRequest The request for password reset.
+ * @return The user object.
+ * @throws ApiException API exception.
+ */
+ public User setUserPasswordPost(ResetPasswordRequest resetPasswordRequest) throws ApiException {
+
+ Object localVarPostBody = resetPasswordRequest;
+
+ // verify the required parameter 'resetPasswordRequest' is set
+ if (resetPasswordRequest == null) {
+ throw new ApiException(400,
+ "Missing the required parameter 'resetPasswordRequest' when calling setPasswordPost");
+ }
+
+ String userTenantDomain = MultitenantConstants.SUPER_TENANT_DOMAIN_NAME;
+ List<Property> properties = resetPasswordRequest.getProperties();
+ for (Property property : properties) {
+ if (StringUtils.equalsIgnoreCase(IdentityManagementEndpointConstants.TENANT_DOMAIN, property.getKey())) {
+ userTenantDomain = property.getValue();
+ properties.remove(property);
+ break;
+ }
+ }
+
+ basePath = IdentityManagementEndpointUtil.getBasePath(userTenantDomain,
+ IdentityManagementEndpointConstants.UserInfoRecovery.RECOVERY_API_RELATIVE_PATH);
+ apiClient.setBasePath(basePath);
+
+ // create path and map variables
+ String localVarPath = "/set-password".replaceAll("\\{format\\}", "json");
+
+ // query params
+ List<Pair> localVarQueryParams = new ArrayList<Pair>();
+ Map<String, String> localVarHeaderParams = new HashMap<String, String>();
+ Map<String, Object> localVarFormParams = new HashMap<String, Object>();
+
+ final String[] localVarAccepts = {
+ "application/json"
+ };
+ final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
+
+ final String[] localVarContentTypes = {
+ "application/json"
+ };
+ final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
+
+ String[] localVarAuthNames = new String[] {};
+ GenericType<User> localVarReturnType = new GenericType<User>() {
+ };
+
+ return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams,
+ localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
+ }
+
+ /**
+ * This API is used to validate code of self registered users.
+ *
+ * @param code Code retried after user self registration and optional property parameters (required).
+ * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body.
*/
public void validateCodePostCall(CodeValidationRequest code) throws ApiException {
