From df9f5cdb6060e88b6ac51769ca2405e3851cd152 Mon Sep 17 00:00:00 2001 From: lashinie Date: Tue, 26 Nov 2024 10:48:06 +0530 Subject: [PATCH 1/2] remove spring dependency from governance API user recovery --- .../pom.xml | 5 ---- .../factories/CaptchaApiServiceFactory.java | 21 +++++++++++-- .../factories/ClaimsApiServiceFactory.java | 21 +++++++++++-- .../RecoverPasswordApiServiceFactory.java | 21 +++++++++++-- .../RecoverUsernameApiServiceFactory.java | 21 +++++++++++-- .../SetPasswordApiServiceFactory.java | 21 +++++++++++-- .../ValidateCodeApiServiceFactory.java | 21 +++++++++++-- .../identity/recovery/endpoint/Constants.java | 19 ++++++++++-- .../recovery/endpoint/Utils/RecoveryUtil.java | 20 +++++++++++-- .../endpoint/impl/ClaimsApiServiceImpl.java | 30 ++++++++++++------- .../impl/RecoverPasswordApiServiceImpl.java | 26 ++++++++++++---- .../impl/RecoverUsernameApiServiceImpl.java | 19 +++++++++++- .../META-INF/cxf/user-recovery-v0-9-cxf.xml | 30 ------------------- 13 files changed, 205 insertions(+), 70 deletions(-) delete mode 100644 components/org.wso2.carbon.identity.api.user.recovery/src/main/resources/META-INF/cxf/user-recovery-v0-9-cxf.xml diff --git a/components/org.wso2.carbon.identity.api.user.recovery/pom.xml b/components/org.wso2.carbon.identity.api.user.recovery/pom.xml index ae7a110038..726bef8b01 100644 --- a/components/org.wso2.carbon.identity.api.user.recovery/pom.xml +++ b/components/org.wso2.carbon.identity.api.user.recovery/pom.xml @@ -147,11 +147,6 @@ cxf-rt-rs-service-description provided - - org.springframework - spring-web - provided - javax.ws.rs javax.ws.rs-api diff --git a/components/org.wso2.carbon.identity.api.user.recovery/src/gen/java/org/wso2/carbon/identity/recovery/endpoint/factories/CaptchaApiServiceFactory.java b/components/org.wso2.carbon.identity.api.user.recovery/src/gen/java/org/wso2/carbon/identity/recovery/endpoint/factories/CaptchaApiServiceFactory.java index 394d3a645f..e636efdde4 100644 --- a/components/org.wso2.carbon.identity.api.user.recovery/src/gen/java/org/wso2/carbon/identity/recovery/endpoint/factories/CaptchaApiServiceFactory.java +++ b/components/org.wso2.carbon.identity.api.user.recovery/src/gen/java/org/wso2/carbon/identity/recovery/endpoint/factories/CaptchaApiServiceFactory.java @@ -1,3 +1,20 @@ +/* + * Copyright (c) 2018-2024, WSO2 LLC. (http://www.wso2.com). + * + * WSO2 LLC. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ package org.wso2.carbon.identity.recovery.endpoint.factories; import org.wso2.carbon.identity.recovery.endpoint.CaptchaApiService; @@ -5,10 +22,10 @@ public class CaptchaApiServiceFactory { - private final static CaptchaApiService service = new CaptchaApiServiceImpl(); + private final static CaptchaApiService SERVICE = new CaptchaApiServiceImpl(); public static CaptchaApiService getCaptchaApi() { - return service; + return SERVICE; } } diff --git a/components/org.wso2.carbon.identity.api.user.recovery/src/gen/java/org/wso2/carbon/identity/recovery/endpoint/factories/ClaimsApiServiceFactory.java b/components/org.wso2.carbon.identity.api.user.recovery/src/gen/java/org/wso2/carbon/identity/recovery/endpoint/factories/ClaimsApiServiceFactory.java index f1816c4d93..f67f88d06e 100644 --- a/components/org.wso2.carbon.identity.api.user.recovery/src/gen/java/org/wso2/carbon/identity/recovery/endpoint/factories/ClaimsApiServiceFactory.java +++ b/components/org.wso2.carbon.identity.api.user.recovery/src/gen/java/org/wso2/carbon/identity/recovery/endpoint/factories/ClaimsApiServiceFactory.java @@ -1,3 +1,20 @@ +/* + * Copyright (c) 2016-2024, WSO2 LLC. (http://www.wso2.com). + * + * WSO2 LLC. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ package org.wso2.carbon.identity.recovery.endpoint.factories; import org.wso2.carbon.identity.recovery.endpoint.ClaimsApiService; @@ -5,10 +22,10 @@ public class ClaimsApiServiceFactory { - private final static ClaimsApiService service = new ClaimsApiServiceImpl(); + private final static ClaimsApiService SERVICE = new ClaimsApiServiceImpl(); public static ClaimsApiService getClaimsApi() { - return service; + return SERVICE; } } diff --git a/components/org.wso2.carbon.identity.api.user.recovery/src/gen/java/org/wso2/carbon/identity/recovery/endpoint/factories/RecoverPasswordApiServiceFactory.java b/components/org.wso2.carbon.identity.api.user.recovery/src/gen/java/org/wso2/carbon/identity/recovery/endpoint/factories/RecoverPasswordApiServiceFactory.java index 5ecacb3fad..ac268b1a98 100644 --- a/components/org.wso2.carbon.identity.api.user.recovery/src/gen/java/org/wso2/carbon/identity/recovery/endpoint/factories/RecoverPasswordApiServiceFactory.java +++ b/components/org.wso2.carbon.identity.api.user.recovery/src/gen/java/org/wso2/carbon/identity/recovery/endpoint/factories/RecoverPasswordApiServiceFactory.java @@ -1,3 +1,20 @@ +/* + * Copyright (c) 2016-2024, WSO2 LLC. (http://www.wso2.com). + * + * WSO2 LLC. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ package org.wso2.carbon.identity.recovery.endpoint.factories; import org.wso2.carbon.identity.recovery.endpoint.RecoverPasswordApiService; @@ -5,10 +22,10 @@ public class RecoverPasswordApiServiceFactory { - private final static RecoverPasswordApiService service = new RecoverPasswordApiServiceImpl(); + private final static RecoverPasswordApiService SERVICE = new RecoverPasswordApiServiceImpl(); public static RecoverPasswordApiService getRecoverPasswordApi() { - return service; + return SERVICE; } } diff --git a/components/org.wso2.carbon.identity.api.user.recovery/src/gen/java/org/wso2/carbon/identity/recovery/endpoint/factories/RecoverUsernameApiServiceFactory.java b/components/org.wso2.carbon.identity.api.user.recovery/src/gen/java/org/wso2/carbon/identity/recovery/endpoint/factories/RecoverUsernameApiServiceFactory.java index 0725794821..fa79bdc45f 100644 --- a/components/org.wso2.carbon.identity.api.user.recovery/src/gen/java/org/wso2/carbon/identity/recovery/endpoint/factories/RecoverUsernameApiServiceFactory.java +++ b/components/org.wso2.carbon.identity.api.user.recovery/src/gen/java/org/wso2/carbon/identity/recovery/endpoint/factories/RecoverUsernameApiServiceFactory.java @@ -1,3 +1,20 @@ +/* + * Copyright (c) 2016-2024, WSO2 LLC. (http://www.wso2.com). + * + * WSO2 LLC. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ package org.wso2.carbon.identity.recovery.endpoint.factories; import org.wso2.carbon.identity.recovery.endpoint.RecoverUsernameApiService; @@ -5,10 +22,10 @@ public class RecoverUsernameApiServiceFactory { - private final static RecoverUsernameApiService service = new RecoverUsernameApiServiceImpl(); + private final static RecoverUsernameApiService SERVICE = new RecoverUsernameApiServiceImpl(); public static RecoverUsernameApiService getRecoverUsernameApi() { - return service; + return SERVICE; } } diff --git a/components/org.wso2.carbon.identity.api.user.recovery/src/gen/java/org/wso2/carbon/identity/recovery/endpoint/factories/SetPasswordApiServiceFactory.java b/components/org.wso2.carbon.identity.api.user.recovery/src/gen/java/org/wso2/carbon/identity/recovery/endpoint/factories/SetPasswordApiServiceFactory.java index f64ac1e14a..9c3f0416a1 100644 --- a/components/org.wso2.carbon.identity.api.user.recovery/src/gen/java/org/wso2/carbon/identity/recovery/endpoint/factories/SetPasswordApiServiceFactory.java +++ b/components/org.wso2.carbon.identity.api.user.recovery/src/gen/java/org/wso2/carbon/identity/recovery/endpoint/factories/SetPasswordApiServiceFactory.java @@ -1,3 +1,20 @@ +/* + * Copyright (c) 2016-2024, WSO2 LLC. (http://www.wso2.com). + * + * WSO2 LLC. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ package org.wso2.carbon.identity.recovery.endpoint.factories; import org.wso2.carbon.identity.recovery.endpoint.SetPasswordApiService; @@ -5,10 +22,10 @@ public class SetPasswordApiServiceFactory { - private final static SetPasswordApiService service = new SetPasswordApiServiceImpl(); + private final static SetPasswordApiService SERVICE = new SetPasswordApiServiceImpl(); public static SetPasswordApiService getSetPasswordApi() { - return service; + return SERVICE; } } diff --git a/components/org.wso2.carbon.identity.api.user.recovery/src/gen/java/org/wso2/carbon/identity/recovery/endpoint/factories/ValidateCodeApiServiceFactory.java b/components/org.wso2.carbon.identity.api.user.recovery/src/gen/java/org/wso2/carbon/identity/recovery/endpoint/factories/ValidateCodeApiServiceFactory.java index c92db6ae22..5df1bcce01 100644 --- a/components/org.wso2.carbon.identity.api.user.recovery/src/gen/java/org/wso2/carbon/identity/recovery/endpoint/factories/ValidateCodeApiServiceFactory.java +++ b/components/org.wso2.carbon.identity.api.user.recovery/src/gen/java/org/wso2/carbon/identity/recovery/endpoint/factories/ValidateCodeApiServiceFactory.java @@ -1,3 +1,20 @@ +/* + * Copyright (c) 2017-2024, WSO2 LLC. (http://www.wso2.com). + * + * WSO2 LLC. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ package org.wso2.carbon.identity.recovery.endpoint.factories; import org.wso2.carbon.identity.recovery.endpoint.ValidateCodeApiService; @@ -5,10 +22,10 @@ public class ValidateCodeApiServiceFactory { - private final static ValidateCodeApiService service = new ValidateCodeApiServiceImpl(); + private final static ValidateCodeApiService SERVICE = new ValidateCodeApiServiceImpl(); public static ValidateCodeApiService getValidateCodeApi() { - return service; + return SERVICE; } } diff --git a/components/org.wso2.carbon.identity.api.user.recovery/src/main/java/org/wso2/carbon/identity/recovery/endpoint/Constants.java b/components/org.wso2.carbon.identity.api.user.recovery/src/main/java/org/wso2/carbon/identity/recovery/endpoint/Constants.java index cd43832169..01725db452 100644 --- a/components/org.wso2.carbon.identity.api.user.recovery/src/main/java/org/wso2/carbon/identity/recovery/endpoint/Constants.java +++ b/components/org.wso2.carbon.identity.api.user.recovery/src/main/java/org/wso2/carbon/identity/recovery/endpoint/Constants.java @@ -1,3 +1,20 @@ +/* + * Copyright (c) 2016-2024, WSO2 LLC. (http://www.wso2.com). + * + * WSO2 LLC. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ package org.wso2.carbon.identity.recovery.endpoint; public final class Constants { @@ -12,8 +29,6 @@ public final class Constants { public static final String DEFAULT_RESPONSE_CONTENT_TYPE = APPLICATION_JSON; public static final String HEADER_CONTENT_TYPE = "Content-Type"; - - //default error messages public static final String STATUS_FORBIDDEN_MESSAGE_DEFAULT = "Forbidden"; public static final String STATUS_NOT_FOUND_MESSAGE_DEFAULT = "Not Found"; diff --git a/components/org.wso2.carbon.identity.api.user.recovery/src/main/java/org/wso2/carbon/identity/recovery/endpoint/Utils/RecoveryUtil.java b/components/org.wso2.carbon.identity.api.user.recovery/src/main/java/org/wso2/carbon/identity/recovery/endpoint/Utils/RecoveryUtil.java index 9aef837e70..d4f6e1f461 100644 --- a/components/org.wso2.carbon.identity.api.user.recovery/src/main/java/org/wso2/carbon/identity/recovery/endpoint/Utils/RecoveryUtil.java +++ b/components/org.wso2.carbon.identity.api.user.recovery/src/main/java/org/wso2/carbon/identity/recovery/endpoint/Utils/RecoveryUtil.java @@ -1,3 +1,20 @@ +/* + * Copyright (c) 2016-2024, WSO2 LLC. (http://www.wso2.com). + * + * WSO2 LLC. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ package org.wso2.carbon.identity.recovery.endpoint.Utils; import org.apache.commons.lang.StringUtils; @@ -24,7 +41,6 @@ import org.wso2.carbon.identity.recovery.endpoint.Exceptions.InternalServerErrorException; import org.wso2.carbon.identity.recovery.endpoint.dto.ClaimDTO; import org.wso2.carbon.identity.recovery.endpoint.dto.ErrorDTO; -import org.wso2.carbon.identity.recovery.endpoint.dto.LinkDTO; import org.wso2.carbon.identity.recovery.endpoint.dto.PropertyDTO; import org.wso2.carbon.identity.recovery.endpoint.dto.ReCaptchaResponseTokenDTO; import org.wso2.carbon.identity.recovery.endpoint.dto.UserClaimDTO; @@ -48,12 +64,10 @@ import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; -import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Map; import java.util.Properties; -import java.util.UUID; public class RecoveryUtil { private static final String USERNAME_CLAIM = "http://wso2.org/claims/username"; diff --git a/components/org.wso2.carbon.identity.api.user.recovery/src/main/java/org/wso2/carbon/identity/recovery/endpoint/impl/ClaimsApiServiceImpl.java b/components/org.wso2.carbon.identity.api.user.recovery/src/main/java/org/wso2/carbon/identity/recovery/endpoint/impl/ClaimsApiServiceImpl.java index 351d4f0355..3f984d7d5b 100644 --- a/components/org.wso2.carbon.identity.api.user.recovery/src/main/java/org/wso2/carbon/identity/recovery/endpoint/impl/ClaimsApiServiceImpl.java +++ b/components/org.wso2.carbon.identity.api.user.recovery/src/main/java/org/wso2/carbon/identity/recovery/endpoint/impl/ClaimsApiServiceImpl.java @@ -1,3 +1,20 @@ +/* + * Copyright (c) 2016-2024, WSO2 LLC. (http://www.wso2.com). + * + * WSO2 LLC. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ package org.wso2.carbon.identity.recovery.endpoint.impl; import org.apache.commons.lang.StringUtils; @@ -7,19 +24,10 @@ import org.wso2.carbon.identity.recovery.IdentityRecoveryClientException; import org.wso2.carbon.identity.recovery.IdentityRecoveryConstants; import org.wso2.carbon.identity.recovery.IdentityRecoveryException; -import org.wso2.carbon.identity.recovery.endpoint.*; +import org.wso2.carbon.identity.recovery.endpoint.ClaimsApiService; +import org.wso2.carbon.identity.recovery.endpoint.Constants; import org.wso2.carbon.identity.recovery.endpoint.Utils.RecoveryUtil; -import org.wso2.carbon.identity.recovery.endpoint.dto.*; - - -import org.wso2.carbon.identity.recovery.endpoint.dto.ErrorDTO; import org.wso2.carbon.identity.recovery.endpoint.dto.ClaimDTO; - -import java.util.List; - -import java.io.InputStream; - -import org.apache.cxf.jaxrs.ext.multipart.Attachment; import org.wso2.carbon.identity.recovery.username.NotificationUsernameRecoveryManager; import org.wso2.carbon.user.api.Claim; import org.wso2.carbon.utils.multitenancy.MultitenantConstants; diff --git a/components/org.wso2.carbon.identity.api.user.recovery/src/main/java/org/wso2/carbon/identity/recovery/endpoint/impl/RecoverPasswordApiServiceImpl.java b/components/org.wso2.carbon.identity.api.user.recovery/src/main/java/org/wso2/carbon/identity/recovery/endpoint/impl/RecoverPasswordApiServiceImpl.java index 1cbb5a138b..0713f92564 100644 --- a/components/org.wso2.carbon.identity.api.user.recovery/src/main/java/org/wso2/carbon/identity/recovery/endpoint/impl/RecoverPasswordApiServiceImpl.java +++ b/components/org.wso2.carbon.identity.api.user.recovery/src/main/java/org/wso2/carbon/identity/recovery/endpoint/impl/RecoverPasswordApiServiceImpl.java @@ -1,3 +1,20 @@ +/* + * Copyright (c) 2016-2024, WSO2 LLC. (http://www.wso2.com). + * + * WSO2 LLC. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ package org.wso2.carbon.identity.recovery.endpoint.impl; import org.apache.commons.lang.StringUtils; @@ -11,13 +28,11 @@ import org.wso2.carbon.identity.recovery.IdentityRecoveryConstants; import org.wso2.carbon.identity.recovery.IdentityRecoveryException; import org.wso2.carbon.identity.recovery.bean.NotificationResponseBean; -import org.wso2.carbon.identity.recovery.endpoint.*; +import org.wso2.carbon.identity.recovery.endpoint.Constants; +import org.wso2.carbon.identity.recovery.endpoint.RecoverPasswordApiService; import org.wso2.carbon.identity.recovery.endpoint.Utils.RecoveryUtil; -import org.wso2.carbon.identity.recovery.endpoint.dto.*; - - import org.wso2.carbon.identity.recovery.endpoint.dto.RecoveryInitiatingRequestDTO; - +import org.wso2.carbon.identity.recovery.endpoint.dto.UserDTO; import org.wso2.carbon.identity.recovery.internal.IdentityRecoveryServiceDataHolder; import org.wso2.carbon.identity.recovery.password.NotificationPasswordRecoveryManager; import org.wso2.carbon.identity.recovery.util.Utils; @@ -27,7 +42,6 @@ public class RecoverPasswordApiServiceImpl extends RecoverPasswordApiService { private static final Log LOG = LogFactory.getLog(RecoverPasswordApiServiceImpl.class); - private static final String USERNAME_CLAIM = "http://wso2.org/claims/username"; @Override public Response recoverPasswordPost(RecoveryInitiatingRequestDTO recoveryInitiatingRequest, String type, diff --git a/components/org.wso2.carbon.identity.api.user.recovery/src/main/java/org/wso2/carbon/identity/recovery/endpoint/impl/RecoverUsernameApiServiceImpl.java b/components/org.wso2.carbon.identity.api.user.recovery/src/main/java/org/wso2/carbon/identity/recovery/endpoint/impl/RecoverUsernameApiServiceImpl.java index 58b799549f..d33c9156b8 100644 --- a/components/org.wso2.carbon.identity.api.user.recovery/src/main/java/org/wso2/carbon/identity/recovery/endpoint/impl/RecoverUsernameApiServiceImpl.java +++ b/components/org.wso2.carbon.identity.api.user.recovery/src/main/java/org/wso2/carbon/identity/recovery/endpoint/impl/RecoverUsernameApiServiceImpl.java @@ -1,3 +1,20 @@ +/* + * Copyright (c) 2016-2024, WSO2 LLC. (http://www.wso2.com). + * + * WSO2 LLC. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ package org.wso2.carbon.identity.recovery.endpoint.impl; import org.apache.commons.lang.StringUtils; @@ -13,9 +30,9 @@ import org.wso2.carbon.identity.recovery.endpoint.dto.UserClaimDTO; import org.wso2.carbon.identity.recovery.username.NotificationUsernameRecoveryManager; -import javax.ws.rs.core.Response; import java.util.List; +import javax.ws.rs.core.Response; public class RecoverUsernameApiServiceImpl extends RecoverUsernameApiService { diff --git a/components/org.wso2.carbon.identity.api.user.recovery/src/main/resources/META-INF/cxf/user-recovery-v0-9-cxf.xml b/components/org.wso2.carbon.identity.api.user.recovery/src/main/resources/META-INF/cxf/user-recovery-v0-9-cxf.xml deleted file mode 100644 index c29bb9e75f..0000000000 --- a/components/org.wso2.carbon.identity.api.user.recovery/src/main/resources/META-INF/cxf/user-recovery-v0-9-cxf.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - From 3ef57e0dec23d1b1a012d8ebad552b5f8c9ba08f Mon Sep 17 00:00:00 2001 From: lashinie Date: Thu, 28 Nov 2024 14:53:20 +0530 Subject: [PATCH 2/2] revert formatting changes --- .../identity/recovery/endpoint/Constants.java | 19 ++---------- .../recovery/endpoint/Utils/RecoveryUtil.java | 20 ++----------- .../endpoint/impl/ClaimsApiServiceImpl.java | 30 +++++++------------ .../impl/RecoverPasswordApiServiceImpl.java | 26 ++++------------ .../impl/RecoverUsernameApiServiceImpl.java | 19 +----------- 5 files changed, 23 insertions(+), 91 deletions(-) diff --git a/components/org.wso2.carbon.identity.api.user.recovery/src/main/java/org/wso2/carbon/identity/recovery/endpoint/Constants.java b/components/org.wso2.carbon.identity.api.user.recovery/src/main/java/org/wso2/carbon/identity/recovery/endpoint/Constants.java index 01725db452..cd43832169 100644 --- a/components/org.wso2.carbon.identity.api.user.recovery/src/main/java/org/wso2/carbon/identity/recovery/endpoint/Constants.java +++ b/components/org.wso2.carbon.identity.api.user.recovery/src/main/java/org/wso2/carbon/identity/recovery/endpoint/Constants.java @@ -1,20 +1,3 @@ -/* - * Copyright (c) 2016-2024, WSO2 LLC. (http://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ package org.wso2.carbon.identity.recovery.endpoint; public final class Constants { @@ -29,6 +12,8 @@ public final class Constants { public static final String DEFAULT_RESPONSE_CONTENT_TYPE = APPLICATION_JSON; public static final String HEADER_CONTENT_TYPE = "Content-Type"; + + //default error messages public static final String STATUS_FORBIDDEN_MESSAGE_DEFAULT = "Forbidden"; public static final String STATUS_NOT_FOUND_MESSAGE_DEFAULT = "Not Found"; diff --git a/components/org.wso2.carbon.identity.api.user.recovery/src/main/java/org/wso2/carbon/identity/recovery/endpoint/Utils/RecoveryUtil.java b/components/org.wso2.carbon.identity.api.user.recovery/src/main/java/org/wso2/carbon/identity/recovery/endpoint/Utils/RecoveryUtil.java index d4f6e1f461..9aef837e70 100644 --- a/components/org.wso2.carbon.identity.api.user.recovery/src/main/java/org/wso2/carbon/identity/recovery/endpoint/Utils/RecoveryUtil.java +++ b/components/org.wso2.carbon.identity.api.user.recovery/src/main/java/org/wso2/carbon/identity/recovery/endpoint/Utils/RecoveryUtil.java @@ -1,20 +1,3 @@ -/* - * Copyright (c) 2016-2024, WSO2 LLC. (http://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ package org.wso2.carbon.identity.recovery.endpoint.Utils; import org.apache.commons.lang.StringUtils; @@ -41,6 +24,7 @@ import org.wso2.carbon.identity.recovery.endpoint.Exceptions.InternalServerErrorException; import org.wso2.carbon.identity.recovery.endpoint.dto.ClaimDTO; import org.wso2.carbon.identity.recovery.endpoint.dto.ErrorDTO; +import org.wso2.carbon.identity.recovery.endpoint.dto.LinkDTO; import org.wso2.carbon.identity.recovery.endpoint.dto.PropertyDTO; import org.wso2.carbon.identity.recovery.endpoint.dto.ReCaptchaResponseTokenDTO; import org.wso2.carbon.identity.recovery.endpoint.dto.UserClaimDTO; @@ -64,10 +48,12 @@ import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Map; import java.util.Properties; +import java.util.UUID; public class RecoveryUtil { private static final String USERNAME_CLAIM = "http://wso2.org/claims/username"; diff --git a/components/org.wso2.carbon.identity.api.user.recovery/src/main/java/org/wso2/carbon/identity/recovery/endpoint/impl/ClaimsApiServiceImpl.java b/components/org.wso2.carbon.identity.api.user.recovery/src/main/java/org/wso2/carbon/identity/recovery/endpoint/impl/ClaimsApiServiceImpl.java index 3f984d7d5b..351d4f0355 100644 --- a/components/org.wso2.carbon.identity.api.user.recovery/src/main/java/org/wso2/carbon/identity/recovery/endpoint/impl/ClaimsApiServiceImpl.java +++ b/components/org.wso2.carbon.identity.api.user.recovery/src/main/java/org/wso2/carbon/identity/recovery/endpoint/impl/ClaimsApiServiceImpl.java @@ -1,20 +1,3 @@ -/* - * Copyright (c) 2016-2024, WSO2 LLC. (http://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ package org.wso2.carbon.identity.recovery.endpoint.impl; import org.apache.commons.lang.StringUtils; @@ -24,10 +7,19 @@ import org.wso2.carbon.identity.recovery.IdentityRecoveryClientException; import org.wso2.carbon.identity.recovery.IdentityRecoveryConstants; import org.wso2.carbon.identity.recovery.IdentityRecoveryException; -import org.wso2.carbon.identity.recovery.endpoint.ClaimsApiService; -import org.wso2.carbon.identity.recovery.endpoint.Constants; +import org.wso2.carbon.identity.recovery.endpoint.*; import org.wso2.carbon.identity.recovery.endpoint.Utils.RecoveryUtil; +import org.wso2.carbon.identity.recovery.endpoint.dto.*; + + +import org.wso2.carbon.identity.recovery.endpoint.dto.ErrorDTO; import org.wso2.carbon.identity.recovery.endpoint.dto.ClaimDTO; + +import java.util.List; + +import java.io.InputStream; + +import org.apache.cxf.jaxrs.ext.multipart.Attachment; import org.wso2.carbon.identity.recovery.username.NotificationUsernameRecoveryManager; import org.wso2.carbon.user.api.Claim; import org.wso2.carbon.utils.multitenancy.MultitenantConstants; diff --git a/components/org.wso2.carbon.identity.api.user.recovery/src/main/java/org/wso2/carbon/identity/recovery/endpoint/impl/RecoverPasswordApiServiceImpl.java b/components/org.wso2.carbon.identity.api.user.recovery/src/main/java/org/wso2/carbon/identity/recovery/endpoint/impl/RecoverPasswordApiServiceImpl.java index 0713f92564..1cbb5a138b 100644 --- a/components/org.wso2.carbon.identity.api.user.recovery/src/main/java/org/wso2/carbon/identity/recovery/endpoint/impl/RecoverPasswordApiServiceImpl.java +++ b/components/org.wso2.carbon.identity.api.user.recovery/src/main/java/org/wso2/carbon/identity/recovery/endpoint/impl/RecoverPasswordApiServiceImpl.java @@ -1,20 +1,3 @@ -/* - * Copyright (c) 2016-2024, WSO2 LLC. (http://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ package org.wso2.carbon.identity.recovery.endpoint.impl; import org.apache.commons.lang.StringUtils; @@ -28,11 +11,13 @@ import org.wso2.carbon.identity.recovery.IdentityRecoveryConstants; import org.wso2.carbon.identity.recovery.IdentityRecoveryException; import org.wso2.carbon.identity.recovery.bean.NotificationResponseBean; -import org.wso2.carbon.identity.recovery.endpoint.Constants; -import org.wso2.carbon.identity.recovery.endpoint.RecoverPasswordApiService; +import org.wso2.carbon.identity.recovery.endpoint.*; import org.wso2.carbon.identity.recovery.endpoint.Utils.RecoveryUtil; +import org.wso2.carbon.identity.recovery.endpoint.dto.*; + + import org.wso2.carbon.identity.recovery.endpoint.dto.RecoveryInitiatingRequestDTO; -import org.wso2.carbon.identity.recovery.endpoint.dto.UserDTO; + import org.wso2.carbon.identity.recovery.internal.IdentityRecoveryServiceDataHolder; import org.wso2.carbon.identity.recovery.password.NotificationPasswordRecoveryManager; import org.wso2.carbon.identity.recovery.util.Utils; @@ -42,6 +27,7 @@ public class RecoverPasswordApiServiceImpl extends RecoverPasswordApiService { private static final Log LOG = LogFactory.getLog(RecoverPasswordApiServiceImpl.class); + private static final String USERNAME_CLAIM = "http://wso2.org/claims/username"; @Override public Response recoverPasswordPost(RecoveryInitiatingRequestDTO recoveryInitiatingRequest, String type, diff --git a/components/org.wso2.carbon.identity.api.user.recovery/src/main/java/org/wso2/carbon/identity/recovery/endpoint/impl/RecoverUsernameApiServiceImpl.java b/components/org.wso2.carbon.identity.api.user.recovery/src/main/java/org/wso2/carbon/identity/recovery/endpoint/impl/RecoverUsernameApiServiceImpl.java index d33c9156b8..58b799549f 100644 --- a/components/org.wso2.carbon.identity.api.user.recovery/src/main/java/org/wso2/carbon/identity/recovery/endpoint/impl/RecoverUsernameApiServiceImpl.java +++ b/components/org.wso2.carbon.identity.api.user.recovery/src/main/java/org/wso2/carbon/identity/recovery/endpoint/impl/RecoverUsernameApiServiceImpl.java @@ -1,20 +1,3 @@ -/* - * Copyright (c) 2016-2024, WSO2 LLC. (http://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ package org.wso2.carbon.identity.recovery.endpoint.impl; import org.apache.commons.lang.StringUtils; @@ -30,9 +13,9 @@ import org.wso2.carbon.identity.recovery.endpoint.dto.UserClaimDTO; import org.wso2.carbon.identity.recovery.username.NotificationUsernameRecoveryManager; +import javax.ws.rs.core.Response; import java.util.List; -import javax.ws.rs.core.Response; public class RecoverUsernameApiServiceImpl extends RecoverUsernameApiService {