From 41a05db710d560e9beef23a731abe02684ad968d Mon Sep 17 00:00:00 2001 From: vimukthiRajapaksha Date: Sun, 26 Jan 2025 14:02:12 +0530 Subject: [PATCH 1/3] Bump carbon.identity.framework.version Enable RAR integration tests --- .../tests-backend/src/test/resources/testng.xml | 5 ++--- pom.xml | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) 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 b504b0c66a..0be73fd912 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 @@ -148,9 +148,8 @@ - - - + + diff --git a/pom.xml b/pom.xml index 843c138463..09de982e29 100755 --- a/pom.xml +++ b/pom.xml @@ -2417,7 +2417,7 @@ - 7.7.141 + 7.7.143 [5.14.67, 8.0.0) 1.0.2 From 5c0d4bc4c0713072a73756bbb1c38d848977e63a Mon Sep 17 00:00:00 2001 From: vimukthiRajapaksha Date: Sun, 26 Jan 2025 21:48:06 +0530 Subject: [PATCH 2/3] Change RAR tests execution order --- .../tests-backend/src/test/resources/testng.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 0be73fd912..2e4628e2b9 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 @@ -139,6 +139,8 @@ + + @@ -148,8 +150,6 @@ - - From 6d1ebb7f4a8cd85bff2b9bf6ae11cf7728a6236f Mon Sep 17 00:00:00 2001 From: vimukthiRajapaksha Date: Mon, 27 Jan 2025 03:03:31 +0530 Subject: [PATCH 3/3] Resolve unit tests failure Sign in if user has session timed out --- ...thorizationRequestsGrantTypesTestCase.java | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/oauth2/OAuth2RichAuthorizationRequestsGrantTypesTestCase.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/oauth2/OAuth2RichAuthorizationRequestsGrantTypesTestCase.java index a512b6a05b..505130ffb8 100644 --- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/oauth2/OAuth2RichAuthorizationRequestsGrantTypesTestCase.java +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/oauth2/OAuth2RichAuthorizationRequestsGrantTypesTestCase.java @@ -297,9 +297,23 @@ public void testAccessTokenRequestWithoutAuthorizationDetails(Asserter asserter) description = "Test authorization code grant flow with invalid authorization details") public void testAuthorizationCodeGrantFlowWithInvalidAuthorizationDetails(Asserter asserter) throws Exception { - final HttpResponse response = super.sendPostRequestWithParameters(this.client, - this.getAuthzRequestParams(asserter), OAuth2Constant.AUTHORIZE_ENDPOINT_URL); - final Header locationHeader = response.getFirstHeader(OAuth2Constant.HTTP_RESPONSE_HEADER_LOCATION); + HttpResponse response = super.sendPostRequestWithParameters(this.client, this.getAuthzRequestParams(asserter), + OAuth2Constant.AUTHORIZE_ENDPOINT_URL); + Header locationHeader = response.getFirstHeader(OAuth2Constant.HTTP_RESPONSE_HEADER_LOCATION); + final String sessionDataKey = DataExtractUtil.getParamFromURIString(locationHeader.getValue(), + OAuth2Constant.SESSION_DATA_KEY); + EntityUtils.consume(response.getEntity()); + + if (StringUtils.isNotBlank(sessionDataKey)) { + // A user session might not available - trying to authenticate the user + response = sendLoginPost(this.client, sessionDataKey); + locationHeader = response.getFirstHeader(OAuth2Constant.HTTP_RESPONSE_HEADER_LOCATION); + EntityUtils.consume(response.getEntity()); + + response = sendGetRequest(this.client, locationHeader.getValue()); + locationHeader = response.getFirstHeader(OAuth2Constant.HTTP_RESPONSE_HEADER_LOCATION); + EntityUtils.consume(response.getEntity()); + } assertEquals(DataExtractUtil.getParamFromURIString(locationHeader.getValue(), ERROR), INVALID_AUTHORIZATION_DETAILS);