diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/application/authz/ApplicationAuthzTenantTestCase.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/application/authz/ApplicationAuthzTenantTestCase.java index db13dc6ab65..c90f24ae5a9 100644 --- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/application/authz/ApplicationAuthzTenantTestCase.java +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/application/authz/ApplicationAuthzTenantTestCase.java @@ -61,7 +61,6 @@ public class ApplicationAuthzTenantTestCase extends AbstractApplicationAuthzTest private static final String AZ_TEST_TENANT_USER_PW = "azTest123"; private static final String NON_AZ_TEST_TENANT_USER = "nonAzTestTenantUser"; private static final String NON_AZ_TEST_TENANT_USER_PW = "nonAzTest123"; - private static final String WSO2_DOMAIN = "@wso2.com"; private static final Log log = LogFactory.getLog(ApplicationAuthzTenantTestCase.class); private static final String APPLICATION_NAME = "travelocity.com-saml-tenantwithoutsigning"; private static final String POLICY_ID = "spTenantAuthPolicy"; @@ -93,11 +92,13 @@ public class ApplicationAuthzTenantTestCase extends AbstractApplicationAuthzTest ""; private String userId; + private String tenantQualifiedCommonAuthURL; @BeforeClass(alwaysRun = true) public void testInit() throws Exception { super.init(TestUserMode.TENANT_ADMIN); + tenantQualifiedCommonAuthURL = getTenantQualifiedURL(COMMON_AUTH_URL, tenantInfo.getDomain()); ConfigurationContext configContext = ConfigurationContextFactory .createConfigurationContextFromFileSystem(null, null); applicationManagementServiceClient = @@ -157,8 +158,8 @@ public void testAuthorizedTenantSAMLSSOLogin() throws Exception { Utils.sendGetRequest(String.format(SAML_SSO_LOGIN_URL, APPLICATION_NAME, HTTP_REDIRECT), USER_AGENT, httpClientAzUser); String sessionKey = Utils.extractDataFromResponse(response, CommonConstants.SESSION_DATA_KEY, 1); - response = Utils.sendPOSTMessage(sessionKey, COMMON_AUTH_URL, USER_AGENT, ACS_URL, APPLICATION_NAME, - AZ_TEST_TENANT_USER + WSO2_DOMAIN, AZ_TEST_TENANT_USER_PW, httpClientAzUser); + response = Utils.sendPOSTMessage(sessionKey, tenantQualifiedCommonAuthURL, USER_AGENT, ACS_URL, APPLICATION_NAME, + AZ_TEST_TENANT_USER, AZ_TEST_TENANT_USER_PW, httpClientAzUser, tenantQualifiedCommonAuthURL); String locationHeader = Utils.getRedirectUrl(response); if (Utils.requestMissingClaims(response)) { @@ -166,7 +167,7 @@ public void testAuthorizedTenantSAMLSSOLogin() throws Exception { Assert.assertNotNull(pastrCookie, "pastr cookie not found in response."); EntityUtils.consume(response.getEntity()); - response = Utils.sendPOSTConsentMessage(response, COMMON_AUTH_URL, USER_AGENT, locationHeader, + response = Utils.sendPOSTConsentMessage(response, tenantQualifiedCommonAuthURL, USER_AGENT, locationHeader, httpClientAzUser, pastrCookie); } EntityUtils.consume(response.getEntity()); @@ -176,9 +177,9 @@ public void testAuthorizedTenantSAMLSSOLogin() throws Exception { Assert.assertNotNull(pastrCookie, "pastr cookie not found in response."); EntityUtils.consume(response.getEntity()); - response = Utils.sendPOSTConsentMessage(response, COMMON_AUTH_URL, USER_AGENT, - String.format(ACS_URL, APPLICATION_NAME), - httpClientAzUser, pastrCookie); + response = Utils.sendPOSTConsentMessage(response, tenantQualifiedCommonAuthURL, USER_AGENT, + String.format(ACS_URL, APPLICATION_NAME), + httpClientAzUser, pastrCookie); EntityUtils.consume(response.getEntity()); } @@ -198,8 +199,9 @@ public void testUnauthorizedTenantSAMLSSOLogin() throws Exception { HttpResponse response = Utils.sendGetRequest(String.format(SAML_SSO_LOGIN_URL, APPLICATION_NAME, HTTP_REDIRECT), USER_AGENT, httpClientNonAzUser); String sessionKey = Utils.extractDataFromResponse(response, CommonConstants.SESSION_DATA_KEY, 1); - response = Utils.sendPOSTMessage(sessionKey, COMMON_AUTH_URL, USER_AGENT, ACS_URL, APPLICATION_NAME, - NON_AZ_TEST_TENANT_USER + WSO2_DOMAIN, NON_AZ_TEST_TENANT_USER_PW, httpClientNonAzUser); + response = Utils.sendPOSTMessage(sessionKey, tenantQualifiedCommonAuthURL, USER_AGENT, ACS_URL, APPLICATION_NAME, + NON_AZ_TEST_TENANT_USER, NON_AZ_TEST_TENANT_USER_PW, httpClientNonAzUser, + tenantQualifiedCommonAuthURL); String redirectUrl = Utils.getRedirectUrl(response); if (Utils.requestMissingClaims(response)) { @@ -207,7 +209,7 @@ public void testUnauthorizedTenantSAMLSSOLogin() throws Exception { Assert.assertNotNull(pastrCookie, "pastr cookie not found in response."); EntityUtils.consume(response.getEntity()); - response = Utils.sendPOSTConsentMessage(response, COMMON_AUTH_URL, USER_AGENT, redirectUrl, + response = Utils.sendPOSTConsentMessage(response, tenantQualifiedCommonAuthURL, USER_AGENT, redirectUrl, httpClientNonAzUser, pastrCookie); redirectUrl = Utils.getRedirectUrl(response); } diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/idp/mgt/PreferenceAPIIntegrationUITestCase.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/idp/mgt/PreferenceAPIIntegrationUITestCase.java index f5aedec6d48..66c0cfa61d7 100644 --- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/idp/mgt/PreferenceAPIIntegrationUITestCase.java +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/idp/mgt/PreferenceAPIIntegrationUITestCase.java @@ -93,7 +93,7 @@ public void testInit() throws Exception { superTenantResidentIDP = superTenantIDPMgtClient.getResidentIdP(); adminClient = new OauthAdminClient(backendURL, sessionCookie); String isServerBackendUrl = isServer.getContextUrls().getWebAppURLHttps(); - recoveryEndpoint = isServerBackendUrl +"/t/" + activeTenant + RECOVERY_ENDPOINT_URL; + recoveryEndpoint = getTenantQualifiedURL(isServerBackendUrl + RECOVERY_ENDPOINT_URL, tenantInfo.getDomain()); createOIDCApplication(); } @@ -225,8 +225,8 @@ private void updateResidentIDP(IdentityProvider residentIdentityProvider) throws private String getAuthzRequestUrl(String clientId, String callbackUrl) { - return OAuth2Constant.AUTHORIZE_ENDPOINT_URL + "?" + "client_id=" + clientId + "&redirect_uri=" + callbackUrl + - "&response_type=code&scope=openid"; + return getTenantQualifiedURL(OAuth2Constant.AUTHORIZE_ENDPOINT_URL + "?" + "client_id=" + clientId + "&redirect_uri=" + callbackUrl + + "&response_type=code&scope=openid", tenantInfo.getDomain()); } private String sendAuthorizeRequest() throws IOException { diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/application/management/v1/model/InboundProtocolListItem.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/application/management/v1/model/InboundProtocolListItem.java index ae570a401a4..b2a5739d1ac 100644 --- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/application/management/v1/model/InboundProtocolListItem.java +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/application/management/v1/model/InboundProtocolListItem.java @@ -74,7 +74,7 @@ public InboundProtocolListItem self(String self) { return this; } - @ApiModelProperty(example = "/t/carbon.super/api/server/v1/applications/29048810-1447-4ea0-a348-30d15ab65fa3/inbound-protocols/saml") + @ApiModelProperty(example = "/api/server/v1/applications/29048810-1447-4ea0-a348-30d15ab65fa3/inbound-protocols/saml") @JsonProperty("self") @Valid public String getSelf() { diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/user/authorized/apps/v2/MeAuthorizedAppsScopeTest.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/user/authorized/apps/v2/MeAuthorizedAppsScopeTest.java index 18f415842bf..6b33367ac54 100644 --- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/user/authorized/apps/v2/MeAuthorizedAppsScopeTest.java +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/user/authorized/apps/v2/MeAuthorizedAppsScopeTest.java @@ -85,8 +85,7 @@ public class MeAuthorizedAppsScopeTest extends UserAuthorizedAppsBaseTest { private String accessToken; private List accessTokes = new ArrayList<>(); - private static final String AUTHORIZED_API_ENDPOINT = "https://localhost:9853/t/carbon" + - ".super/api/users/v2/me/authorized-apps"; + private static final String AUTHORIZED_API_ENDPOINT = "https://localhost:9853/api/users/v2/me/authorized-apps"; private String requestedScopes = "openid test_internal_login test_internal_user_update test_SYSTEM"; @BeforeClass(alwaysRun = true) diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/user/liteUserRegister/LiteUserRegisterTestBase.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/user/liteUserRegister/LiteUserRegisterTestBase.java index e1fccf205b4..c10542957f2 100644 --- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/user/liteUserRegister/LiteUserRegisterTestBase.java +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/user/liteUserRegister/LiteUserRegisterTestBase.java @@ -38,7 +38,7 @@ public class LiteUserRegisterTestBase extends RESTAPIUserTestBase { protected static final String API_USERNAME_CLAIM_PATH = - "/t/carbon.super/api/server/v1/claim-dialects/local/claims/aHR0cDovL3dzbzIub3JnL2NsYWltcy91c2VybmFtZQ"; + "/api/server/v1/claim-dialects/local/claims/aHR0cDovL3dzbzIub3JnL2NsYWltcy91c2VybmFtZQ"; protected static final String API_DEFINITION_NAME_LITE_USER_REGISTER = "api.identity.user.yaml"; protected static final String ENABLE_EMAIL_USERNAME_DEPLOYMENT_CONFIG = "enable_email_username_deployment.toml"; protected static final String LITE_USER_REGISTER_CLAIM_EMAIL_AS_USERNAME_JSON = diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/user/session/v1/UserSessionMeSuccessTest.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/user/session/v1/UserSessionMeSuccessTest.java index f7cdcb4b672..da468efd01a 100644 --- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/user/session/v1/UserSessionMeSuccessTest.java +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/user/session/v1/UserSessionMeSuccessTest.java @@ -128,8 +128,6 @@ public void testDeleteUserSessionById() { List newSessionIdList = getResponseOfGet(this.sessionsEndpointURI).jsonPath().getList("sessions.id"); - Assert.assertEquals(sessionIdList.size(), 2); - Assert.assertEquals(newSessionIdList.size(), 1); Assert.assertFalse(newSessionIdList.contains(sessionIdList.get(0))); } diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/util/Utils.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/util/Utils.java index f76f036f1a3..be6c9d83b2a 100644 --- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/util/Utils.java +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/util/Utils.java @@ -136,13 +136,20 @@ public static void setSystemProperties(Class classIn) { public static HttpResponse sendPOSTMessage(String sessionKey, String url, String userAgent, String acsUrl, String artifact, String userName, String password, HttpClient httpClient) throws Exception { + return sendPOSTMessage(sessionKey, url, userAgent, acsUrl, artifact, userName, password, httpClient, + SAML_SSO_URL); + } + + public static HttpResponse sendPOSTMessage(String sessionKey, String url, String userAgent, String + acsUrl, String artifact, String userName, String password, HttpClient httpClient, String samlSSOUrl) throws Exception { + HttpPost post = new HttpPost(url); post.setHeader("User-Agent", userAgent); post.addHeader("Referer", String.format(acsUrl, artifact)); List urlParameters = new ArrayList(); urlParameters.add(new BasicNameValuePair("username", userName)); urlParameters.add(new BasicNameValuePair("password", password)); - if (StringUtils.equals(url, SAML_SSO_URL)) { + if (StringUtils.equals(url, samlSSOUrl)) { urlParameters.add(new BasicNameValuePair("tocommonauth", "true")); } urlParameters.add(new BasicNameValuePair("sessionDataKey", sessionKey)); diff --git a/modules/integration/tests-integration/tests-backend/src/test/resources/artifacts/IS/saml/registrymount/travelocity.properties b/modules/integration/tests-integration/tests-backend/src/test/resources/artifacts/IS/saml/registrymount/travelocity.properties index cf710190755..f02d499f158 100644 --- a/modules/integration/tests-integration/tests-backend/src/test/resources/artifacts/IS/saml/registrymount/travelocity.properties +++ b/modules/integration/tests-integration/tests-backend/src/test/resources/artifacts/IS/saml/registrymount/travelocity.properties @@ -40,10 +40,10 @@ SAML2.SPEntityId=travelocity.com-registrymount SAML2.AssertionConsumerURL=http://localhost:8490/travelocity.com-registrymount/home.jsp #A unique identifier for this SAML 2.0 Service Provider application -SAML2.IdPEntityId=localhost +SAML2.IdPEntityId=localhost/t/registrymount.com #The URL of the SAML 2.0 Identity Provider -SAML2.IdPURL=https://localhost:9853/samlsso +SAML2.IdPURL=https://localhost:9853/t/registrymount.com/samlsso #Identifier given for the Service Provider for SAML 2.0 attributes #exchange @@ -81,7 +81,7 @@ PrivateKeyAlias=wso2carbon PrivateKeyPassword=wso2carbon #OAuth2 token endpoint URL -SAML2.OAuth2TokenURL=https://localhost:9853/oauth2/token +SAML2.OAuth2TokenURL=https://localhost:9853/t/registrymount.com/oauth2/token #OAuth2 Client ID SAML2.OAuth2ClientId=Qn5DQHCYfshxeZh6R9SL1HM2lsMa @@ -90,7 +90,7 @@ SAML2.OAuth2ClientId=Qn5DQHCYfshxeZh6R9SL1HM2lsMa SAML2.OAuth2ClientSecret=cbkAs1gajdwPAMbrSR54hPAIcz0a #OpenId Provider Url -OpenId.ProviderURL=https://localhost:9853/openid/ +OpenId.ProviderURL=https://localhost:9853/t/registrymount.com/openid/ #openid.return_to parameter OpenId.ReturnToURL=http://localhost:8490/travelocity.com-registrymount/home.jsp @@ -100,7 +100,6 @@ OpenId.ReturnToURL=http://localhost:8490/travelocity.com-registrymount/home.jsp #Additional request parameters #SAML.Request.Query.Param=&forceAuth=true -QueryParams=&tenantDomain=registrymount.com #Specify whether the consumer requests user attributes from the provider OpenId.EnableAttributeExchange=true diff --git a/modules/integration/tests-integration/tests-backend/src/test/resources/artifacts/IS/saml/tenantwithoutsigning/travelocity.properties b/modules/integration/tests-integration/tests-backend/src/test/resources/artifacts/IS/saml/tenantwithoutsigning/travelocity.properties index 9a55c43e8e1..c3b11d2ac61 100644 --- a/modules/integration/tests-integration/tests-backend/src/test/resources/artifacts/IS/saml/tenantwithoutsigning/travelocity.properties +++ b/modules/integration/tests-integration/tests-backend/src/test/resources/artifacts/IS/saml/tenantwithoutsigning/travelocity.properties @@ -40,12 +40,12 @@ SAML2.SPEntityId=travelocity.com-saml-tenantwithoutsigning SAML2.AssertionConsumerURL=http://localhost:8490/travelocity.com-saml-tenantwithoutsigning/home.jsp #A unique identifier for this SAML 2.0 Service Provider application -SAML2.IdPEntityId=localhost +SAML2.IdPEntityId=localhost/t/wso2.com #The URL of the SAML 2.0 Identity Provider -SAML2.IdPURL=https://localhost:9853/samlsso +SAML2.IdPURL=https://localhost:9853/t/wso2.com/samlsso -#Identifier given for the Service Provider for SAML 2.0 attributes +#Identifier given for the Service Provider for SAML 2.0 attributes #exchange #SAML2.AttributeConsumingServiceIndex=1701087467 @@ -67,7 +67,7 @@ SAML2.EnableAssertionEncryption=false #Specify if AuthnRequests and LogoutRequests should be signed SAML2.EnableRequestSigning=true -SAML2.ArtifactResolveUrl=https://localhost:9853/samlartresolve +SAML2.ArtifactResolveUrl=https://localhost:9853/t/wso2.com/samlartresolve SAML2.EnableArtifactResolveSigning=true @@ -77,15 +77,15 @@ KeyStorePassword=wso2carbon #Alias of the IdP's public certificate IdPPublicCertAlias=wso2carbon -#Alias of the SP's private key +#Alias of the SP's private key PrivateKeyAlias=wso2carbon -#Private key password to retrieve the private key used to sign +#Private key password to retrieve the private key used to sign #AuthnRequest and LogoutRequest messages PrivateKeyPassword=wso2carbon #OAuth2 token endpoint URL -SAML2.OAuth2TokenURL=https://localhost:9853/oauth2/token +SAML2.OAuth2TokenURL=https://localhost:9853/t/wso2.com/oauth2/token #OAuth2 Client ID SAML2.OAuth2ClientId=Qn5DQHCYfshxeZh6R9SL1HM2lsMa @@ -94,7 +94,7 @@ SAML2.OAuth2ClientId=Qn5DQHCYfshxeZh6R9SL1HM2lsMa SAML2.OAuth2ClientSecret=cbkAs1gajdwPAMbrSR54hPAIcz0a #OpenId Provider Url -OpenId.ProviderURL=https://localhost:9853/openid/ +OpenId.ProviderURL=https://localhost:9853/t/wso2.com/openid/ #openid.return_to parameter OpenId.ReturnToURL=http://localhost:8490/travelocity.com-saml-tenantwithoutsigning/home.jsp @@ -104,7 +104,6 @@ OpenId.ReturnToURL=http://localhost:8490/travelocity.com-saml-tenantwithoutsigni #Additional request parameters #SAML.Request.Query.Param=&forceAuth=true -QueryParams=&tenantDomain=wso2.com #Specify whether the consumer requests user attributes from the provider OpenId.EnableAttributeExchange=true