Skip to content

Commit

Permalink
Revert "Remove challenge questions based test cases"
Browse files Browse the repository at this point in the history
This reverts commit 264a871.
  • Loading branch information
sadilchamishka committed Dec 18, 2023
1 parent 6467dc3 commit 2ea5a9f
Show file tree
Hide file tree
Showing 10 changed files with 479 additions and 7 deletions.
16 changes: 16 additions & 0 deletions modules/api-resources/api-resources-full/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,14 @@
<groupId>org.wso2.carbon.identity.user.api</groupId>
<artifactId>org.wso2.carbon.identity.api.user.common</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon.identity.user.api</groupId>
<artifactId>org.wso2.carbon.identity.rest.api.user.challenge.v1</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon.identity.user.api</groupId>
<artifactId>org.wso2.carbon.identity.api.user.challenge.common</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon.identity.user.api</groupId>
<artifactId>org.wso2.carbon.identity.rest.api.user.association.v1</artifactId>
Expand Down Expand Up @@ -244,6 +252,14 @@
<groupId>org.wso2.carbon.identity.server.api</groupId>
<artifactId>org.wso2.carbon.identity.api.server.common</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon.identity.server.api</groupId>
<artifactId>org.wso2.carbon.identity.rest.api.server.challenge.v1</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon.identity.server.api</groupId>
<artifactId>org.wso2.carbon.identity.api.server.challenge.common</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon.identity.server.api</groupId>
<artifactId>org.wso2.carbon.identity.rest.api.server.claim.management.v1</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
xmlns:jaxrs="http://cxf.apache.org/jaxrs" xmlns:context="http://www.springframework.org/schema/context"
xmlns:cxf="http://cxf.apache.org/core"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd">
<import resource="classpath:META-INF/cxf/user-challenge-v1-cxf.xml"/>
<import resource="classpath:META-INF/cxf/user-association-v1-cxf.xml"/>
<import resource="classpath:META-INF/cxf/authorized-apps-user-v1-cxf.xml"/>
<import resource="classpath:META-INF/cxf/authorized-apps-user-v2-cxf.xml"/>
Expand All @@ -32,6 +33,7 @@
<import resource="classpath:META-INF/cxf/permission-management-v1-cxf.xml"/>
<!--<import resource="classpath:META-INF/cxf/workflow-engine-server-v1-cxf.xml"/>-->
<import resource="classpath:META-INF/cxf/claim-management-server-v1-cxf.xml"/>
<import resource="classpath:META-INF/cxf/challenge-server-v1-cxf.xml"/>
<import resource="classpath:META-INF/cxf/email-template-server-v1-cxf.xml"/>
<import resource="classpath:META-INF/cxf/applications-server-v1-cxf.xml"/>
<import resource="classpath:META-INF/cxf/application-user-v1-cxf.xml"/>
Expand Down Expand Up @@ -90,6 +92,7 @@
</bean>
<jaxrs:server id="server" address="/server/v1">
<jaxrs:serviceBeans>
<bean class="org.wso2.carbon.identity.rest.api.server.challenge.v1.ChallengesApi"/>
<bean class="org.wso2.carbon.identity.rest.api.server.claim.management.v1.ClaimManagementApi"/>
<bean class="org.wso2.carbon.identity.rest.api.server.email.template.v1.EmailApi"/>
<bean class="org.wso2.carbon.identity.api.server.identity.governance.v1.IdentityGovernanceApi"/>
Expand Down Expand Up @@ -204,6 +207,8 @@
<bean class="org.wso2.carbon.identity.rest.api.user.authorized.apps.v1.MeApi"/>
<bean class="org.wso2.carbon.identity.rest.api.user.authorized.apps.v1.UserIdApi"/>
<bean class="org.wso2.carbon.identity.rest.api.user.backupcode.v1.MeApi"/>
<bean class="org.wso2.carbon.identity.rest.api.user.challenge.v1.MeApi"/>
<bean class="org.wso2.carbon.identity.rest.api.user.challenge.v1.UserIdApi"/>
<bean class="org.wso2.carbon.identity.rest.api.user.fido2.v1.MeApi"/>
<bean class="org.wso2.carbon.identity.rest.api.user.functionality.v1.MeApi"/>
<bean class="org.wso2.carbon.identity.rest.api.user.functionality.v1.UserIdApi"/>
Expand Down Expand Up @@ -391,7 +396,10 @@
<bean class="org.wso2.carbon.identity.recovery.endpoint.ClaimsApi"/>
<bean class="org.wso2.carbon.identity.recovery.endpoint.RecoverPasswordApi"/>
<bean class="org.wso2.carbon.identity.recovery.endpoint.RecoverUsernameApi"/>
<bean class="org.wso2.carbon.identity.recovery.endpoint.SecurityQuestionApi"/>
<bean class="org.wso2.carbon.identity.recovery.endpoint.SecurityQuestionsApi"/>
<bean class="org.wso2.carbon.identity.recovery.endpoint.SetPasswordApi"/>
<bean class="org.wso2.carbon.identity.recovery.endpoint.ValidateAnswerApi"/>
<bean class="org.wso2.carbon.identity.recovery.endpoint.ValidateCodeApi"/>
<bean class="org.wso2.carbon.identity.recovery.endpoint.CaptchaApi"/>
</jaxrs:serviceBeans>
Expand Down
10 changes: 10 additions & 0 deletions modules/api-resources/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,11 @@
<artifactId>org.wso2.carbon.identity.api.server.common</artifactId>
<version>${identity.server.api.version}</version>
</dependency>
<dependency>
<groupId>org.wso2.carbon.identity.server.api</groupId>
<artifactId>org.wso2.carbon.identity.rest.api.server.challenge.v1</artifactId>
<version>${identity.server.api.version}</version>
</dependency>
<dependency>
<groupId>org.wso2.carbon.identity.server.api</groupId>
<artifactId>org.wso2.carbon.identity.api.server.identity.governance.v1</artifactId>
Expand All @@ -136,6 +141,11 @@
<artifactId>org.wso2.carbon.identity.api.server.admin.advisory.management.common</artifactId>
<version>${identity.server.api.version}</version>
</dependency>
<dependency>
<groupId>org.wso2.carbon.identity.server.api</groupId>
<artifactId>org.wso2.carbon.identity.api.server.challenge.common</artifactId>
<version>${identity.server.api.version}</version>
</dependency>
<dependency>
<groupId>org.wso2.carbon.identity.server.api</groupId>
<artifactId>org.wso2.carbon.identity.rest.api.server.claim.management.v1</artifactId>
Expand Down
4 changes: 4 additions & 0 deletions modules/integration/tests-common/admin-clients/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,10 @@
<version>1.8.87</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.wso2.carbon.identity.governance</groupId>
<artifactId>org.wso2.carbon.identity.recovery.stub</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon.registry</groupId>
<artifactId>org.wso2.carbon.registry.resource.stub</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* Licensed 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.identity.integration.common.clients.challenge.questions.mgt;

import org.apache.axis2.AxisFault;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.identity.application.common.model.xsd.User;
import org.wso2.carbon.identity.claim.metadata.mgt.stub.ClaimMetadataManagementServiceStub;
import org.wso2.carbon.identity.recovery.stub.ChallengeQuestionManagementAdminServiceStub;
import org.wso2.carbon.identity.recovery.stub.model.ChallengeQuestion;
import org.wso2.carbon.identity.recovery.stub.model.UserChallengeAnswer;
import org.wso2.identity.integration.common.clients.AuthenticateStub;


/**
* Admin service client for ChallengeQuestionManagement Service.
*
*/
public class ChallengeQuestionMgtAdminClient {

private static final Log log = LogFactory.getLog(ChallengeQuestionMgtAdminClient.class);
private static final String SERVICE_NAME = "ChallengeQuestionManagementAdminService";
private ChallengeQuestionManagementAdminServiceStub stub = null;

private String endPoint;

public ChallengeQuestionMgtAdminClient(String backendUrl, String cookie) throws AxisFault {
endPoint = backendUrl + SERVICE_NAME;
stub = new ChallengeQuestionManagementAdminServiceStub(endPoint);
AuthenticateStub.authenticateStub(cookie, stub);
}

public ChallengeQuestionMgtAdminClient(String backEndUrl, String userName, String password) throws AxisFault {
this.endPoint = backEndUrl + SERVICE_NAME;
stub = new ChallengeQuestionManagementAdminServiceStub(endPoint);
AuthenticateStub.authenticateStub(userName, password, stub);
}

public ChallengeQuestion[] getChallengeQuestionsForTenant(String tenantDomain) throws AxisFault {

try {
return stub.getChallengeQuestionsOfTenant(tenantDomain);
} catch (Exception e) {
handleException(e.getMessage(), e);
}
return new ChallengeQuestion[0];
}


public ChallengeQuestion[] getChallengeQuestionsForUser(User user) throws AxisFault {

try {
return stub.getChallengeQuestionsForUser(user);
} catch (Exception e) {
handleException(e.getMessage(), e);
}

return new ChallengeQuestion[0];
}

public ChallengeQuestion[] getChallengeQuestionsForLocale(String tenantDomain, String locale) throws AxisFault {

try {
return stub.getChallengeQuestionsForLocale(tenantDomain, locale);
} catch (Exception e) {
handleException(e.getMessage(), e);
}

return new ChallengeQuestion[0];
}


public void setChallengeQuestions(ChallengeQuestion[] challengeQuestions, String tenantDomain)
throws AxisFault {
try {
stub.setChallengeQuestionsOfTenant(challengeQuestions, tenantDomain);
} catch (Exception e) {
handleException(e.getMessage(), e);
}
}

public void deleteChallengeQuestions(ChallengeQuestion[] challengeQuestions, String tenantDomain)
throws AxisFault {
try {
stub.deleteChallengeQuestionsOfTenant(challengeQuestions, tenantDomain);
} catch (Exception e) {
handleException(e.getMessage(), e);
}
}

public void setUserChallengeAnswers(User user, UserChallengeAnswer[] userChallengeAnswers)
throws AxisFault {
try {
stub.setUserChallengeAnswers(user, userChallengeAnswers);
} catch (Exception e) {
handleException(e.getMessage(), e);
}
}

public UserChallengeAnswer[] getUserChallengeAnswers(User user) throws AxisFault {
try {
return stub.getUserChallengeAnswers(user);
} catch (Exception e) {
handleException(e.getMessage(), e);
}

return new UserChallengeAnswer[0];
}

private String[] handleException(String msg, Exception e) throws AxisFault {
log.error(msg, e);
throw new AxisFault(msg, e);
}
}
Loading

0 comments on commit 2ea5a9f

Please sign in to comment.