From dc6742c415696eb87489b8236e48aadde161725c Mon Sep 17 00:00:00 2001
From: Asha Sulaiman <165079T@uom.lk>
Date: Tue, 28 Nov 2023 12:21:31 +0530
Subject: [PATCH 1/4] Revert "Remove challenge questions related integration
tests"
---
.../api-resources/api-resources-full/pom.xml | 16 ++++++++++++++
.../src/main/webapp/WEB-INF/beans.xml | 8 +++++++
modules/api-resources/pom.xml | 10 +++++++++
.../tests-common/admin-clients/pom.xml | 16 ++++----------
.../OAuth2ServiceAbstractIntegrationTest.java | 8 +++++++
...hCodeGrantOpenIdRequestObjectTestCase.java | 22 +++++++++++++++++++
.../src/test/resources/testng.xml | 14 +++++-------
pom.xml | 5 +++++
8 files changed, 78 insertions(+), 21 deletions(-)
diff --git a/modules/api-resources/api-resources-full/pom.xml b/modules/api-resources/api-resources-full/pom.xml
index 1fe6a057cbd..074f6e5eebc 100644
--- a/modules/api-resources/api-resources-full/pom.xml
+++ b/modules/api-resources/api-resources-full/pom.xml
@@ -105,6 +105,14 @@
org.wso2.carbon.identity.user.api
org.wso2.carbon.identity.api.user.common
+
+ org.wso2.carbon.identity.user.api
+ org.wso2.carbon.identity.rest.api.user.challenge.v1
+
+
+ org.wso2.carbon.identity.user.api
+ org.wso2.carbon.identity.api.user.challenge.common
+
org.wso2.carbon.identity.user.api
org.wso2.carbon.identity.rest.api.user.association.v1
@@ -252,6 +260,14 @@
org.wso2.carbon.identity.server.api
org.wso2.carbon.identity.api.server.common
+
+ org.wso2.carbon.identity.server.api
+ org.wso2.carbon.identity.rest.api.server.challenge.v1
+
+
+ org.wso2.carbon.identity.server.api
+ org.wso2.carbon.identity.api.server.challenge.common
+
org.wso2.carbon.identity.server.api
org.wso2.carbon.identity.rest.api.server.claim.management.v1
diff --git a/modules/api-resources/api-resources-full/src/main/webapp/WEB-INF/beans.xml b/modules/api-resources/api-resources-full/src/main/webapp/WEB-INF/beans.xml
index 3a0668443fa..56b0f76a3f7 100644
--- a/modules/api-resources/api-resources-full/src/main/webapp/WEB-INF/beans.xml
+++ b/modules/api-resources/api-resources-full/src/main/webapp/WEB-INF/beans.xml
@@ -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">
+
@@ -33,6 +34,7 @@
+
@@ -91,6 +93,7 @@
+
@@ -206,6 +209,8 @@
+
+
@@ -392,7 +397,10 @@
+
+
+
diff --git a/modules/api-resources/pom.xml b/modules/api-resources/pom.xml
index 8970bc9096c..0f5e56b540b 100644
--- a/modules/api-resources/pom.xml
+++ b/modules/api-resources/pom.xml
@@ -136,6 +136,11 @@
org.wso2.carbon.identity.api.server.common
${identity.server.api.version}
+
+ org.wso2.carbon.identity.server.api
+ org.wso2.carbon.identity.rest.api.server.challenge.v1
+ ${identity.server.api.version}
+
org.wso2.carbon.identity.server.api
org.wso2.carbon.identity.api.server.identity.governance.v1
@@ -156,6 +161,11 @@
org.wso2.carbon.identity.api.server.admin.advisory.management.common
${identity.server.api.version}
+
+ org.wso2.carbon.identity.server.api
+ org.wso2.carbon.identity.api.server.challenge.common
+ ${identity.server.api.version}
+
org.wso2.carbon.identity.server.api
org.wso2.carbon.identity.rest.api.server.claim.management.v1
diff --git a/modules/integration/tests-common/admin-clients/pom.xml b/modules/integration/tests-common/admin-clients/pom.xml
index 5e942ee5c19..4308c70c513 100644
--- a/modules/integration/tests-common/admin-clients/pom.xml
+++ b/modules/integration/tests-common/admin-clients/pom.xml
@@ -134,6 +134,10 @@
org.wso2.carbon.identity.framework
org.wso2.carbon.identity.governance.stub
+
+ org.wso2.carbon.identity.governance
+ org.wso2.carbon.identity.recovery.stub
+
org.wso2.carbon.registry
org.wso2.carbon.registry.resource.stub
@@ -268,18 +272,6 @@
org.wso2.carbon.registry
org.wso2.carbon.registry.properties.stub
-
-
- org.wso2.carbon.identity.governance
- org.wso2.carbon.identity.recovery.stub
- 1.8.87
- compile
-
diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/oauth2/OAuth2ServiceAbstractIntegrationTest.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/oauth2/OAuth2ServiceAbstractIntegrationTest.java
index be642e53fa3..b31f69e04ac 100644
--- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/oauth2/OAuth2ServiceAbstractIntegrationTest.java
+++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/oauth2/OAuth2ServiceAbstractIntegrationTest.java
@@ -81,6 +81,8 @@ public class OAuth2ServiceAbstractIntegrationTest extends ISIntegrationTest {
protected static final String EMAIL_CLAIM_URI = "http://wso2.org/claims/emailaddress";
private static final String GIVEN_NAME_CLAIM_URI = "http://wso2.org/claims/givenname";
protected static final String COUNTRY_CLAIM_URI = "http://wso2.org/claims/country";
+ private static final String customClaimURI1 = "http://wso2.org/claims/challengeQuestion1";
+ private static final String customClaimURI2 = "http://wso2.org/claims/challengeQuestion2";
private static final String GRANT_TYPE_PASSWORD = "password";
private static final String SCOPE_PRODUCTION = "PRODUCTION";
public static final String OIDC = "oidc";
@@ -353,6 +355,12 @@ private ClaimConfiguration getClaimConfigurations() {
claimConfiguration.addClaimMappingsItem(getClaimMapping(COUNTRY_CLAIM_URI));
claimConfiguration.addRequestedClaimsItem(getRequestedClaim(COUNTRY_CLAIM_URI));
+ claimConfiguration.addClaimMappingsItem(getClaimMapping(customClaimURI1));
+ claimConfiguration.addRequestedClaimsItem(getRequestedClaim(customClaimURI1));
+
+ claimConfiguration.addClaimMappingsItem(getClaimMapping(customClaimURI2));
+ claimConfiguration.addRequestedClaimsItem(getRequestedClaim(customClaimURI2));
+
return claimConfiguration;
}
diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/oauth2/OAuth2ServiceAuthCodeGrantOpenIdRequestObjectTestCase.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/oauth2/OAuth2ServiceAuthCodeGrantOpenIdRequestObjectTestCase.java
index b807e90a15f..485f70104fd 100644
--- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/oauth2/OAuth2ServiceAuthCodeGrantOpenIdRequestObjectTestCase.java
+++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/oauth2/OAuth2ServiceAuthCodeGrantOpenIdRequestObjectTestCase.java
@@ -79,6 +79,10 @@ public class OAuth2ServiceAuthCodeGrantOpenIdRequestObjectTestCase extends OAuth
public static final String ENCODED_OIDC_CLAIM_DIALECT = "aHR0cDovL3dzbzIub3JnL29pZGMvY2xhaW0";
private static final String USERS_PATH = "users";
+ private static final String CHALLENGE_QUESTION_SET_ID1 = "challengeQuestion1";
+ private static final String CHALLENGE_QUESTION_SET_ID2 = "challengeQuestion2";
+ private static final String CHALLENGE_QUESTION_SET1_Q1 = "City where you were born ?";
+ private static final String CHALLENGE_QUESTION_SET2_Q1 = "Model of your first car ?";
private static final String LOCALE = "en_US";
private ServerConfigurationManager serverConfigurationManager;
@@ -100,6 +104,8 @@ public class OAuth2ServiceAuthCodeGrantOpenIdRequestObjectTestCase extends OAuth
private static final String emailClaimURI = "http://wso2.org/claims/emailaddress";
private static final String givenNameClaimURI = "http://wso2.org/claims/givenname";
private static final String countryClaimURI = "http://wso2.org/claims/country";
+ private static final String customClaimURI1 = "http://wso2.org/claims/challengeQuestion1";
+ private static final String customClaimURI2 = "http://wso2.org/claims/challengeQuestion2";
private static final String externalClaimURI1 = "externalClaim1";
private static final String externalClaimURI2 = "externalClaim2";
private static final String USER_EMAIL = "abcrqo@wso2.com";
@@ -120,6 +126,7 @@ public class OAuth2ServiceAuthCodeGrantOpenIdRequestObjectTestCase extends OAuth
private SCIM2RestClient scim2RestClient;
private ClaimManagementRestClient claimManagementRestClient;
+ private ChallengeQuestionsRestClient challengeQuestionsRestClient;
private String applicationId;
private String userId;
@@ -158,9 +165,12 @@ public void testInit() throws Exception {
setSystemproperties();
scim2RestClient = new SCIM2RestClient(serverURL, tenantInfo);
+ challengeQuestionsRestClient = new ChallengeQuestionsRestClient(serverURL, tenantInfo);
claimManagementRestClient = new ClaimManagementRestClient(serverURL, tenantInfo);
addAdminUser();
+ claimId1 = addOIDCClaims(externalClaimURI1, customClaimURI1);
+ claimId2 = addOIDCClaims(externalClaimURI2, customClaimURI2);
}
@@ -185,6 +195,7 @@ public void atEnd() throws Exception {
restClient.closeHttpClient();
scim2RestClient.closeHttpClient();
claimManagementRestClient.closeHttpClient();
+ challengeQuestionsRestClient.closeHttpClient();
client.close();
}
@@ -437,5 +448,16 @@ private void addAdminUser() throws Exception {
patchRoleItem.addValue(new ListObject().value(userId));
scim2RestClient.updateUserRole(new PatchOperationRequestObject().addOperations(patchRoleItem), roleId);
+
+ setChallengeQuestion(CHALLENGE_QUESTION_SET_ID1, CHALLENGE_QUESTION_SET1_Q1, CUSTOM_CLAIM1);
+ setChallengeQuestion(CHALLENGE_QUESTION_SET_ID2, CHALLENGE_QUESTION_SET2_Q1, CUSTOM_CLAIM2);
+ }
+
+ private void setChallengeQuestion(String questionSetId, String question, String answer) throws Exception {
+ UserChallengeAnswer challengeQuestionObj = new UserChallengeAnswer();
+ challengeQuestionObj.setChallengeQuestion(new Questions(LOCALE, question, null));
+ challengeQuestionObj.setAnswer(answer);
+
+ challengeQuestionsRestClient.setChallengeQuestionAnswer(userId, questionSetId, challengeQuestionObj);
}
}
diff --git a/modules/integration/tests-integration/tests-backend/src/test/resources/testng.xml b/modules/integration/tests-integration/tests-backend/src/test/resources/testng.xml
index f0faa4323bc..b0ad09e0277 100644
--- a/modules/integration/tests-integration/tests-backend/src/test/resources/testng.xml
+++ b/modules/integration/tests-integration/tests-backend/src/test/resources/testng.xml
@@ -50,8 +50,7 @@
-
-
+
@@ -119,8 +118,7 @@
-
-
+
@@ -140,9 +138,8 @@
-
-
-
+
+
@@ -160,8 +157,7 @@
-
-
+
diff --git a/pom.xml b/pom.xml
index d51ba885b4b..c258bdd0824 100755
--- a/pom.xml
+++ b/pom.xml
@@ -1175,6 +1175,11 @@
org.wso2.carbon.identity.recovery
${identity.governance.version}
+
+ org.wso2.carbon.identity.governance
+ org.wso2.carbon.identity.recovery.stub
+ ${identity.governance.version}
+
org.wso2.carbon.deployment
org.wso2.carbon.service.mgt.stub
From 7192d966d76aa52df81d50d19d88de2c8bcb5cf9 Mon Sep 17 00:00:00 2001
From: Asha Sulaiman <165079T@uom.lk>
Date: Tue, 28 Nov 2023 12:38:54 +0530
Subject: [PATCH 2/4] add user challenge API
---
.../api-resources-full/src/main/webapp/WEB-INF/beans.xml | 2 ++
1 file changed, 2 insertions(+)
diff --git a/modules/api-resources/api-resources-full/src/main/webapp/WEB-INF/beans.xml b/modules/api-resources/api-resources-full/src/main/webapp/WEB-INF/beans.xml
index 56b0f76a3f7..7f649aa4293 100644
--- a/modules/api-resources/api-resources-full/src/main/webapp/WEB-INF/beans.xml
+++ b/modules/api-resources/api-resources-full/src/main/webapp/WEB-INF/beans.xml
@@ -249,6 +249,8 @@
+
+
From 74d37240bf7384920e0f55a8122fee2d5042e5df Mon Sep 17 00:00:00 2001
From: Asha Sulaiman <165079T@uom.lk>
Date: Tue, 28 Nov 2023 12:40:41 +0530
Subject: [PATCH 3/4] add Question.Password.NotifyStart entry
---
.../v1/get-category-QWNjb3VudCBNYW5hZ2VtZW50-response.json | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/modules/integration/tests-integration/tests-backend/src/test/resources/org/wso2/identity/integration/test/rest/api/server/identity/governance/v1/get-category-QWNjb3VudCBNYW5hZ2VtZW50-response.json b/modules/integration/tests-integration/tests-backend/src/test/resources/org/wso2/identity/integration/test/rest/api/server/identity/governance/v1/get-category-QWNjb3VudCBNYW5hZ2VtZW50-response.json
index 80086d8fabf..0ee959428ec 100644
--- a/modules/integration/tests-integration/tests-backend/src/test/resources/org/wso2/identity/integration/test/rest/api/server/identity/governance/v1/get-category-QWNjb3VudCBNYW5hZ2VtZW50-response.json
+++ b/modules/integration/tests-integration/tests-backend/src/test/resources/org/wso2/identity/integration/test/rest/api/server/identity/governance/v1/get-category-QWNjb3VudCBNYW5hZ2VtZW50-response.json
@@ -131,6 +131,12 @@
"displayName": "Notify when recovery success",
"description": ""
},
+ {
+ "name": "Recovery.Question.Password.NotifyStart",
+ "value": "false",
+ "displayName": "Notify when security questions based recovery starts",
+ "description": ""
+ },
{
"name": "Recovery.ExpiryTime",
"value": "1440",
From f2f217b0cf521ac21b7b05ebefdf6458a9113102 Mon Sep 17 00:00:00 2001
From: Asha Sulaiman <165079T@uom.lk>
Date: Tue, 28 Nov 2023 12:42:40 +0530
Subject: [PATCH 4/4] downgrade dependency version
---
pom.xml | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/pom.xml b/pom.xml
index c258bdd0824..95d7e51e768 100755
--- a/pom.xml
+++ b/pom.xml
@@ -2324,7 +2324,7 @@
2.5.2
- 1.8.89
+ 1.8.87
5.8.5
@@ -2435,8 +2435,8 @@
2.0.13
- 1.3.28
- 1.2.129
+ 1.3.27
+ 1.2.128
5.5.9
5.5.7