From 9de13f5329c8ea646d08b2c2c9dd0b28584b3c14 Mon Sep 17 00:00:00 2001 From: Maduranga Siriwardena Date: Tue, 26 Nov 2024 11:51:08 +0530 Subject: [PATCH 1/4] Remove openid related sample apps --- .../integration/test/base/TomcatInitializerTestCase.java | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/base/TomcatInitializerTestCase.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/base/TomcatInitializerTestCase.java index a51b660a1f3..743c9b3b19b 100644 --- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/base/TomcatInitializerTestCase.java +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/base/TomcatInitializerTestCase.java @@ -45,14 +45,7 @@ public class TomcatInitializerTestCase extends ISIntegrationTest { "PassiveSTSSampleApp", "playground.appone", "playground.apptwo", - "playground2", - // TODO: Check and remove the following with openid tests - "travelocity.com-openid-smartconsumerwithclaims", - "travelocity.com-openid-smartconsumerwithoutclaims", - "travelocity.com-openid-dumbconsumerwithclaims", - "travelocity.com-openid-dumbconsumerwithoutclaims" - // TODO: End of openid apps - + "playground2" }; private static final Log LOG = LogFactory.getLog(TomcatInitializerTestCase.class); From 373c1a8f0025b9cbc817262b29e1be892b484ec2 Mon Sep 17 00:00:00 2001 From: Maduranga Siriwardena Date: Wed, 27 Nov 2024 14:58:02 +0530 Subject: [PATCH 2/4] Remove openid test cases --- .../test/openid/MasterOpenIDInitiator.java | 38 -- .../openid/OpenIDAuthenticationTestCase.java | 96 ---- .../OpenIDProviderServerConfigTestCase.java | 91 ---- .../openid/OpenIDRPManagementTestCase.java | 158 ------ .../test/openid/OpenIDSSOTestCase.java | 475 ------------------ .../openid/OpenIDUserProfileTestCase.java | 191 ------- .../integration/test/openid/OpenIDUtils.java | 115 ----- ...cationManagementPassiveStsSuccessTest.java | 1 - .../src/test/resources/testng.xml | 7 - 9 files changed, 1172 deletions(-) delete mode 100644 modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/openid/MasterOpenIDInitiator.java delete mode 100644 modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/openid/OpenIDAuthenticationTestCase.java delete mode 100644 modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/openid/OpenIDProviderServerConfigTestCase.java delete mode 100644 modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/openid/OpenIDRPManagementTestCase.java delete mode 100644 modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/openid/OpenIDSSOTestCase.java delete mode 100644 modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/openid/OpenIDUserProfileTestCase.java delete mode 100644 modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/openid/OpenIDUtils.java diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/openid/MasterOpenIDInitiator.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/openid/MasterOpenIDInitiator.java deleted file mode 100644 index 4c593462350..00000000000 --- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/openid/MasterOpenIDInitiator.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - *Copyright (c) 2005-2010, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - *WSO2 Inc. 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.identity.integration.test.openid; - -import org.apache.axis2.AxisFault; -import org.wso2.identity.integration.common.clients.openid.OpenIDProviderServiceClient; -import org.wso2.identity.integration.common.clients.usermgt.remote.RemoteUserStoreManagerServiceClient; - -public class MasterOpenIDInitiator { - - protected OpenIDProviderServiceClient openidServiceClient = null; - protected RemoteUserStoreManagerServiceClient remoteUSMServiceClient = null; - - protected void init(int userId) throws AxisFault { -// EnvironmentBuilder builder = new EnvironmentBuilder(); -// isEnvironment = builder.build().getIs(); -// userInfo = UserListCsvReader.getUserInfo(userId); -// String backEndUrl = isEnvironment.getBackEndUrl(); -// String sessionCookie = isEnvironment.getSessionCookie(); -// openidServiceClient = new OpenIDProviderServiceClient(backEndUrl, sessionCookie); -// remoteUSMServiceClient = new RemoteUserStoreManagerServiceClient(backEndUrl, sessionCookie); - } -} \ No newline at end of file diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/openid/OpenIDAuthenticationTestCase.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/openid/OpenIDAuthenticationTestCase.java deleted file mode 100644 index 6a24f8dae61..00000000000 --- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/openid/OpenIDAuthenticationTestCase.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - *Copyright (c) 2005-2010, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - *WSO2 Inc. 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.identity.integration.test.openid; - -import org.testng.Assert; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; -import org.wso2.carbon.identity.provider.openid.stub.dto.OpenIDRememberMeDTO; -import org.wso2.identity.integration.common.clients.openid.OpenIDProviderServiceClient; -import org.wso2.identity.integration.common.utils.ISIntegrationTest; - -public class OpenIDAuthenticationTestCase extends ISIntegrationTest { - - OpenIDProviderServiceClient openidServiceClient; - String adminUserName; - String adminPassword; - - @BeforeClass(alwaysRun = true) - public void testInit() throws Exception { - super.init(); - - openidServiceClient = new OpenIDProviderServiceClient(backendURL, sessionCookie); - adminUserName = userInfo.getUserName(); - adminPassword = userInfo.getPassword(); - } - - @AfterClass(alwaysRun = true) - public void atEnd() throws Exception { - - openidServiceClient = null; - } - - @Test(alwaysRun = true, description = "Authenticate with Password") - public void testOpenidPasswordAuthentication() { - - String openId = Util.getDefaultOpenIDIdentifier(adminUserName); - - boolean isAuthenticated = false; - - try { - isAuthenticated = openidServiceClient.authenticateWithOpenID(openId, adminPassword); - } catch (Exception e) { - Assert.fail("Error while authenticating", e); - } - - Assert.assertTrue(isAuthenticated); - } - - @Test(alwaysRun = true, description = "Authenticate with Remember ME", dependsOnMethods="testOpenidPasswordAuthentication") - public void testOpenidRememberMeAuthentication() { - - // first authenticate without a cookie - String openID = Util.getDefaultOpenIDIdentifier(adminUserName); - OpenIDRememberMeDTO rememberMeDTO = null; - - try { - rememberMeDTO = openidServiceClient.authenticateWithOpenIDRememberMe(openID, adminPassword, "127.0.0.1", null); - } catch (Exception e) { - Assert.fail("Error while authenticating with remember me", e); - } - - Assert.assertTrue(rememberMeDTO.getAuthenticated()); - - // now lets authenticate with remember me - - String cookie = rememberMeDTO.getNewCookieValue(); - - OpenIDRememberMeDTO newRememberMeDTO = null; - - try { - newRememberMeDTO = openidServiceClient.authenticateWithOpenIDRememberMe(openID, null, "127.0.0.1", cookie); - } catch (Exception e) { - Assert.fail("Error while authenticating with remember me cookie", e); - } - - Assert.assertTrue(newRememberMeDTO.getAuthenticated()); - - } - -} diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/openid/OpenIDProviderServerConfigTestCase.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/openid/OpenIDProviderServerConfigTestCase.java deleted file mode 100644 index 3ba83a73901..00000000000 --- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/openid/OpenIDProviderServerConfigTestCase.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - *Copyright (c) 2005-2010, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - *WSO2 Inc. 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.identity.integration.test.openid; - -import java.rmi.RemoteException; - -import org.testng.Assert; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; -import org.wso2.carbon.identity.provider.openid.stub.dto.OpenIDProviderInfoDTO; -import org.wso2.identity.integration.common.clients.openid.OpenIDProviderServiceClient; -import org.wso2.identity.integration.common.utils.ISIntegrationTest; - -public class OpenIDProviderServerConfigTestCase extends ISIntegrationTest { - - OpenIDProviderServiceClient openidServiceClient; - String adminUserName; - - @BeforeClass(alwaysRun = true) - public void testInit() throws Exception { - super.init(); - - openidServiceClient = new OpenIDProviderServiceClient(backendURL, sessionCookie); - adminUserName = userInfo.getUserName(); - } - - @AfterClass(alwaysRun = true) - public void atEnd() throws Exception { - openidServiceClient = null; - } - - - @Test(alwaysRun = true, description = "Testing Provider Info") - public void testProviderInfo() { - - OpenIDProviderInfoDTO providerInfo = null; - - try { - providerInfo = openidServiceClient.getOpenIDProviderInfo(adminUserName, - Util.getDefaultOpenIDIdentifier(adminUserName)); - } catch (Exception e) { - Assert.fail("Error while getting OpenID Provider Info", e); - } - - Assert.assertEquals(providerInfo.getOpenID(), "https://localhost:9853/openid/admin"); - - Assert.assertEquals(providerInfo.getOpenIDProviderServerUrl(), "https://localhost:9853/openidserver"); - } - - @Test(alwaysRun = true, description = "Test Session Timeout", dependsOnMethods = "testProviderInfo") - public void testSessionTimeOut() { - - int sessionTimeout = 0; - try { - sessionTimeout = openidServiceClient.getOpenIDSessionTimeout(); - } catch (RemoteException e) { - Assert.fail("Error while getting session timeout", e); - } - - Assert.assertEquals(sessionTimeout, 36000); - } - - @Test(alwaysRun = true, description = "Check SkipUserConsent", dependsOnMethods = "testSessionTimeOut") - public void testSkipUserConsent() { - - boolean isSkipped = true; - try { - isSkipped = openidServiceClient.isOpenIDUserApprovalBypassEnabled(); - } catch (RemoteException e) { - Assert.fail("Error while reading SkipUserConsent config", e); - } - - Assert.assertFalse(isSkipped); - } -} diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/openid/OpenIDRPManagementTestCase.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/openid/OpenIDRPManagementTestCase.java deleted file mode 100644 index 20127507556..00000000000 --- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/openid/OpenIDRPManagementTestCase.java +++ /dev/null @@ -1,158 +0,0 @@ -/* - *Copyright (c) 2005-2010, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - *WSO2 Inc. 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.identity.integration.test.openid; - -import java.util.Calendar; -import java.util.Date; - -import org.testng.Assert; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; -import org.wso2.carbon.identity.provider.openid.stub.dto.OpenIDUserRPDTO; -import org.wso2.identity.integration.common.clients.openid.OpenIDProviderServiceClient; -import org.wso2.identity.integration.common.utils.ISIntegrationTest; - -public class OpenIDRPManagementTestCase extends ISIntegrationTest { - - OpenIDProviderServiceClient openidServiceClient; - - private String userName = "admin"; - private String profileName = "default"; - - private String rp1Url = "http://localhost:8490/openidclient"; - private boolean rp1TrustedAlways = false; - private int rp1VisitCount = 0; - private Date rp1lastVisit = Calendar.getInstance().getTime(); - - private String rp2Url = "http://localhost:8490/openidclient2"; - private boolean rp2TrustedAlways = true; - private int rp2VisitCount = 1; - private Date rp2lastVisit = Calendar.getInstance().getTime(); - - @BeforeClass(alwaysRun = true) - public void testInit() throws Exception { - super.init(); - - openidServiceClient = new OpenIDProviderServiceClient(backendURL, sessionCookie); - } - - @AfterClass(alwaysRun = true) - public void atEnd() throws Exception { - openidServiceClient = null; - } - - @Test(alwaysRun = true, description = "Authenticate with Password") - public void testOpenidRPAddUpdate() { - - // add rp1 - OpenIDUserRPDTO rp1dto = new OpenIDUserRPDTO(); - rp1dto.setDefaultProfileName(profileName); - rp1dto.setUserName(userName); - rp1dto.setOpenID(Util.getDefaultOpenIDIdentifier(userName)); - rp1dto.setRpUrl(rp1Url); - rp1dto.setTrustedAlways(rp1TrustedAlways); - rp1dto.setVisitCount(rp1VisitCount); - rp1dto.setLastVisit(rp1lastVisit); - - try { - openidServiceClient.updateOpenIDUserRPInfo(rp1dto); - } catch (Exception e) { - Assert.fail("Error while updating user RPInfo", e); - } - - // add rp2 - OpenIDUserRPDTO rp2dto = new OpenIDUserRPDTO(); - rp2dto.setDefaultProfileName(profileName); - rp2dto.setUserName(userName); - rp2dto.setOpenID(Util.getDefaultOpenIDIdentifier(userName)); - rp2dto.setRpUrl(rp2Url); - rp2dto.setTrustedAlways(rp2TrustedAlways); - rp2dto.setVisitCount(rp2VisitCount); - rp2dto.setLastVisit(rp2lastVisit); - - try { - openidServiceClient.updateOpenIDUserRPInfo(rp2dto); - } catch (Exception e) { - Assert.fail("Error while updating user RPInfo", e); - } - - // reading rps back - OpenIDUserRPDTO[] rps = null; - - try { - rps = openidServiceClient.getOpenIDUserRPs(Util.getDefaultOpenIDIdentifier(userName)); - } catch (Exception e) { - Assert.fail("Error while getting user RPs", e); - } - - // we should get two rps - Assert.assertEquals(rps.length, 2); - - // lets read values back and check - for(OpenIDUserRPDTO rp : rps) { - - if(rp1Url.equals(rp.getRpUrl())) { - Assert.assertEquals(rp.getTrustedAlways(), rp1TrustedAlways); - Assert.assertEquals(rp.getUserName(), userName); - - } else if(rp2Url.equals(rp.getRpUrl())) { - Assert.assertEquals(rp.getTrustedAlways(), rp2TrustedAlways); - Assert.assertEquals(rp.getUserName(), userName); - - } else { - Assert.fail("Invalid RP returned"); - } - - } - - // update the RP1, lets trust it always - rp1TrustedAlways = true; - rp1VisitCount++; - rp1lastVisit = Calendar.getInstance().getTime(); - - // update rp1 - OpenIDUserRPDTO rp1Updateddto = new OpenIDUserRPDTO(); - rp1Updateddto.setDefaultProfileName(profileName); - rp1Updateddto.setUserName(userName); - rp1Updateddto.setOpenID(Util.getDefaultOpenIDIdentifier(userName)); - rp1Updateddto.setRpUrl(rp1Url); - rp1Updateddto.setTrustedAlways(rp1TrustedAlways); - rp1Updateddto.setVisitCount(rp1VisitCount); - rp1Updateddto.setLastVisit(rp1lastVisit); - try { - openidServiceClient.updateOpenIDUserRPInfo(rp1Updateddto); - } catch (Exception e) { - Assert.fail("Error while updating user RPInfo", e); - } - - // read the RP1 back now - OpenIDUserRPDTO rp1updted = null; - try { - rp1updted = openidServiceClient.getOpenIDUserRPInfo(Util.getDefaultOpenIDIdentifier(userName), rp1Url); - } catch (Exception e) { - Assert.fail("Error while updating user RPInfo", e); - } - - Assert.assertEquals(rp1updted.getRpUrl(), rp1Url); - - Assert.assertEquals(rp1updted.getTrustedAlways(), rp1TrustedAlways); - - } - -} diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/openid/OpenIDSSOTestCase.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/openid/OpenIDSSOTestCase.java deleted file mode 100644 index 51bce7c5df1..00000000000 --- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/openid/OpenIDSSOTestCase.java +++ /dev/null @@ -1,475 +0,0 @@ -/* - * Copyright (c) 2005-2010, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. 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.identity.integration.test.openid; - -import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.http.Header; -import org.apache.http.HttpResponse; -import org.apache.http.NameValuePair; -import org.apache.http.client.config.CookieSpecs; -import org.apache.http.client.config.RequestConfig; -import org.apache.http.client.entity.UrlEncodedFormEntity; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.config.Lookup; -import org.apache.http.config.RegistryBuilder; -import org.apache.http.cookie.CookieSpecProvider; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClientBuilder; -import org.apache.http.impl.cookie.RFC6265CookieSpecProvider; -import org.apache.http.message.BasicNameValuePair; -import org.apache.http.util.EntityUtils; -import org.testng.Assert; -import org.testng.annotations.AfterClass; -import org.testng.annotations.AfterMethod; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; -import org.wso2.carbon.integration.common.utils.mgt.ServerConfigurationManager; -import org.wso2.carbon.um.ws.api.stub.ClaimValue; -import org.wso2.identity.integration.common.clients.usermgt.remote.RemoteUserStoreManagerServiceClient; -import org.wso2.identity.integration.common.utils.ISIntegrationTest; -import org.wso2.identity.integration.test.util.Utils; - -import java.io.BufferedReader; -import java.io.File; -import java.io.IOException; -import java.io.InputStreamReader; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class OpenIDSSOTestCase extends ISIntegrationTest { - private static final Log log = LogFactory.getLog(OpenIDSSOTestCase.class); - - private static final String USER_AGENT = "Apache-HttpClient/4.2.5 (java 1.6)"; - private static final String COMMON_AUTH_URL = "https://localhost:9853/commonauth"; - private static final String OPEN_ID_PROFILE_URL = "https://localhost:9853/authenticationendpoint/openid_profile.do"; - private static final String APPROVAL_URL = "https://localhost:9853/openidserver"; - private static final String OPEN_ID_URL = "http://localhost:8490/%s/openid?OpenId" + - ".ClaimedId=https://localhost:9853/openid/"; - //Claim Uris - private static final String firstNameClaimURI = "http://axschema.org/namePerson/first"; - private static final String emailClaimURI = "http://axschema.org/contact/email"; - private static final String lastNameClaimURI = "http://wso2.org/claims/lastname"; - private static final String profileName = "default"; - - private OpenIDUtils.OpenIDConfig config; - private RemoteUserStoreManagerServiceClient remoteUSMServiceClient; - private Lookup cookieSpecRegistry; - private RequestConfig requestConfig; - private CloseableHttpClient client; - private File identityXML; - private ServerConfigurationManager serverConfigurationManager; - - @Factory(dataProvider = "openIdConfigBeanProvider") - public OpenIDSSOTestCase(OpenIDUtils.OpenIDConfig configBean) { - if (log.isDebugEnabled()){ - log.info("OpenId Test initialized for " + configBean); - } - - this.config = configBean; - } - - @BeforeClass(alwaysRun = true) - public void init() throws Exception { - super.init(); - - if (config.getUserConsent() == OpenIDUtils.UserConsent.SKIP){ - changeISConfiguration(); - super.init(); - } - - remoteUSMServiceClient = new RemoteUserStoreManagerServiceClient(backendURL, sessionCookie); - } - - @AfterClass(alwaysRun = true) - public void clear() throws Exception{ - if (config.getUserConsent() == OpenIDUtils.UserConsent.SKIP){ - resetISConfiguration(); - } - - remoteUSMServiceClient = null; - client.close(); - } - - @BeforeMethod - public void createUser(){ - OpenIDUtils.User user = config.getUser(); - - log.info("Creating User " + user.getUsername()); - - ClaimValue firstName = new ClaimValue(); - firstName.setClaimURI(firstNameClaimURI); - firstName.setValue(user.getUsername()); - - ClaimValue lastName = new ClaimValue(); - lastName.setClaimURI(lastNameClaimURI); - lastName.setValue(user.getUsername()); - - ClaimValue email = new ClaimValue(); - email.setClaimURI(emailClaimURI); - email.setValue(user.getEmail()); - - try { - // creating the user - remoteUSMServiceClient.addUser(user.getUsername(), user.getPassword(), - new String[]{user.getRole()}, new ClaimValue[]{email, firstName, lastName}, - profileName, true); - } catch (Exception e) { - Assert.fail("Error while creating the user", e); - } - - } - - @AfterMethod - public void deleteUser(){ - log.info("Deleting User " + config.getUser().getUsername()); - try { - remoteUSMServiceClient.deleteUser(config.getUser().getUsername()); - } catch (Exception e) { - Assert.fail("Error while deleting the user", e); - } - } - - @Test(alwaysRun = true, groups = "wso2.is", description = "Testing OpenId sample parameterized test") - public void testOpenId() throws IOException { - if (log.isDebugEnabled()){ - log.debug("Executing Test Case for " + config); - } - - HttpResponse response; - String results; - - cookieSpecRegistry = RegistryBuilder.create() - .register(CookieSpecs.DEFAULT, new RFC6265CookieSpecProvider()) - .build(); - requestConfig = RequestConfig.custom() - .setCookieSpec(CookieSpecs.DEFAULT) - .build(); - client = HttpClientBuilder.create() - .setDefaultCookieSpecRegistry(cookieSpecRegistry) - .setDefaultRequestConfig(requestConfig) - .build(); - - response = executePhaseBeforeApproval(); - - if (config.getUserConsent() != OpenIDUtils.UserConsent.SKIP) { - response = executePhaseAfterApproval(response); - } - - results = extractDataFromResponse(response); - - assertLogin(results); - - if (config.getAppType() == OpenIDUtils.AppType.SMART_WITH_CLAIMS || - config.getAppType() == OpenIDUtils.AppType.DUMB_WITH_CLAIMS){ - assertAttributes(results); - } - - if (config.getUserConsent() == OpenIDUtils.UserConsent.APPROVE_ALWAYS){ - client = HttpClientBuilder.create() - .setDefaultCookieSpecRegistry(cookieSpecRegistry) - .setDefaultRequestConfig(requestConfig) - .build(); - - response = executePhaseBeforeApproval(); - results = extractDataFromResponse(response); - - assertLogin(results); - } - } - - private HttpResponse executePhaseBeforeApproval() throws IOException { - HttpResponse response; - String sessionKey; - Map keyPositionMap; - - response = sendOpenIdGet(); - keyPositionMap = new HashMap(1); - keyPositionMap.put("name=\"sessionDataKey\"", 1); - sessionKey = extractDataFromResponse(response, keyPositionMap).get(0).getValue(); - - response = sendLoginPost(sessionKey); - EntityUtils.consume(response.getEntity()); - - return sendRedirectGet(response); - } - - private HttpResponse executePhaseAfterApproval(HttpResponse response) throws IOException { - Map keyPositionMap; - List keyValues; - - keyPositionMap = new HashMap(); - keyPositionMap.put("openid.identity", 5); - keyPositionMap.put("openid.return_to", 5); - keyPositionMap.put("claimTag", 5); - keyPositionMap.put("claimValue", 5); - - keyValues = extractDataFromResponse(response,keyPositionMap); - assertClaims(keyValues); - - response = sendOpenIdProfilePost(keyValues); - EntityUtils.consume(response.getEntity()); - - response = sendApprovalPost(); - EntityUtils.consume(response.getEntity()); - - return sendRedirectGet(response); - } - - @DataProvider(name = "openIdConfigBeanProvider") - public static OpenIDUtils.OpenIDConfig[][] openIdConfigBeanProvider(){ - return new OpenIDUtils.OpenIDConfig[][]{ - {new OpenIDUtils.OpenIDConfig(OpenIDUtils.User.ADMIN, - OpenIDUtils.UserConsent.APPROVE, OpenIDUtils.AppType.SMART_WITH_CLAIMS)}, - {new OpenIDUtils.OpenIDConfig(OpenIDUtils.User.ADMIN, - OpenIDUtils.UserConsent.APPROVE, OpenIDUtils.AppType.SMART_WITHOUT_CLAIMS)}, - {new OpenIDUtils.OpenIDConfig(OpenIDUtils.User.ADMIN, - OpenIDUtils.UserConsent.APPROVE, OpenIDUtils.AppType.DUMB_WITH_CLAIMS)}, - {new OpenIDUtils.OpenIDConfig(OpenIDUtils.User.ADMIN, - OpenIDUtils.UserConsent.APPROVE, OpenIDUtils.AppType.DUMB_WITHOUT_CLAIMS)}, - {new OpenIDUtils.OpenIDConfig(OpenIDUtils.User.USER1, - OpenIDUtils.UserConsent.APPROVE, OpenIDUtils.AppType.SMART_WITH_CLAIMS)}, - {new OpenIDUtils.OpenIDConfig(OpenIDUtils.User.USER1, - OpenIDUtils.UserConsent.APPROVE, OpenIDUtils.AppType.SMART_WITHOUT_CLAIMS)}, - {new OpenIDUtils.OpenIDConfig(OpenIDUtils.User.USER1, - OpenIDUtils.UserConsent.APPROVE, OpenIDUtils.AppType.DUMB_WITH_CLAIMS)}, - {new OpenIDUtils.OpenIDConfig(OpenIDUtils.User.USER1, - OpenIDUtils.UserConsent.APPROVE, OpenIDUtils.AppType.DUMB_WITHOUT_CLAIMS)}, - {new OpenIDUtils.OpenIDConfig(OpenIDUtils.User.USER2, - OpenIDUtils.UserConsent.APPROVE_ALWAYS, OpenIDUtils.AppType.SMART_WITH_CLAIMS)}, - {new OpenIDUtils.OpenIDConfig(OpenIDUtils.User.USER2, - OpenIDUtils.UserConsent.APPROVE_ALWAYS, OpenIDUtils.AppType.SMART_WITHOUT_CLAIMS)}, - {new OpenIDUtils.OpenIDConfig(OpenIDUtils.User.USER2, - OpenIDUtils.UserConsent.APPROVE_ALWAYS, OpenIDUtils.AppType.DUMB_WITH_CLAIMS)}, - {new OpenIDUtils.OpenIDConfig(OpenIDUtils.User.USER2, - OpenIDUtils.UserConsent.APPROVE_ALWAYS, OpenIDUtils.AppType.DUMB_WITHOUT_CLAIMS)}, - /*{new OpenIDUtils.OpenIDConfig(OpenIDUtils.User.USER1, - OpenIDUtils.UserConsent.SKIP, OpenIDUtils.AppType.SMART_WITH_CLAIMS)}, - {new OpenIDUtils.OpenIDConfig(OpenIDUtils.User.USER1, - OpenIDUtils.UserConsent.SKIP, OpenIDUtils.AppType.SMART_WITHOUT_CLAIMS)}, - {new OpenIDUtils.OpenIDConfig(OpenIDUtils.User.USER1, - OpenIDUtils.UserConsent.SKIP, OpenIDUtils.AppType.DUMB_WITH_CLAIMS)}, - {new OpenIDUtils.OpenIDConfig(OpenIDUtils.User.USER1, - OpenIDUtils.UserConsent.SKIP, OpenIDUtils.AppType.DUMB_WITHOUT_CLAIMS)},*/ - }; - } - - private List extractDataFromResponse(HttpResponse response, Map keyPositionMap) throws IOException { - List keyValues = new ArrayList(); - BufferedReader rd = new BufferedReader( - new InputStreamReader(response.getEntity().getContent())); - String line; - while ((line = rd.readLine()) != null) { - for (String key: keyPositionMap.keySet()){ - if (line.contains(key)) { - String[] tokens = line.split("'"); - KeyValue keyValue = new KeyValue(key, tokens[keyPositionMap.get(key)]); - keyValues.add(keyValue); - } - } - } - rd.close(); - - return keyValues; - } - - private String extractDataFromResponse(HttpResponse response) throws IOException { - StringBuilder sb = new StringBuilder(); - BufferedReader rd = new BufferedReader( - new InputStreamReader(response.getEntity().getContent())); - String line; - while ((line = rd.readLine()) != null) { - sb.append(line); - } - rd.close(); - return sb.toString(); - } - - private HttpResponse sendOpenIdGet() throws IOException { - HttpGet request = new HttpGet(String.format(OPEN_ID_URL, config.getAppType().getArtifact())); - request.addHeader("User-Agent", USER_AGENT); - - return client.execute(request); - } - - private HttpResponse sendLoginPost(String sessionKey) throws IOException { - HttpPost request = new HttpPost(COMMON_AUTH_URL); - request.setHeader("User-Agent", USER_AGENT); - - List urlParameters = new ArrayList(); - urlParameters.add(new BasicNameValuePair("username", config.getUser().getUsername() + "@" + tenantInfo.getDomain())); - urlParameters.add(new BasicNameValuePair("password", config.getUser().getPassword())); - urlParameters.add(new BasicNameValuePair("sessionDataKey", sessionKey)); - - request.setEntity(new UrlEncodedFormEntity(urlParameters)); - - return client.execute(request); - } - - private HttpResponse sendRedirectGet(HttpResponse response) throws IOException { - Header[] headers = response.getAllHeaders(); - String url = ""; - for (Header header : headers) { - if ("Location".equals(header.getName())) { - url = header.getValue(); - } - } - - url = StringUtils.replace(url, "/t/" + tenantInfo.getDomain(), ""); - HttpGet request = new HttpGet(url); - request.addHeader("User-Agent", USER_AGENT); - - return client.execute(request); - } - - private HttpResponse sendOpenIdProfilePost(List keyValues) throws IOException { - HttpPost request = new HttpPost(OPEN_ID_PROFILE_URL); - request.setHeader("User-Agent", USER_AGENT); - - List urlParameters = new ArrayList(); - - for (KeyValue keyValue:keyValues){ - urlParameters.add(new BasicNameValuePair(keyValue.getKey(), keyValue.getValue())); - } - - request.setEntity(new UrlEncodedFormEntity(urlParameters)); - - return client.execute(request); - } - - private HttpResponse sendApprovalPost() throws IOException { - HttpPost request = new HttpPost(APPROVAL_URL); - request.setHeader("User-Agent", USER_AGENT); - - boolean approvedAlways = (config.getUserConsent() == OpenIDUtils.UserConsent.APPROVE_ALWAYS); - - List urlParameters = new ArrayList(1); - urlParameters.add(new BasicNameValuePair("hasApprovedAlways", String.valueOf(approvedAlways))); - - request.setEntity(new UrlEncodedFormEntity(urlParameters)); - - return client.execute(request); - } - - private void assertClaims(List keyValues){ - StringBuilder sb = new StringBuilder(); - for (KeyValue keyValue:keyValues){ - if (keyValue.key.equals("claimTag")){ - sb.append(keyValue.getValue()); - sb.append(","); - } - - if (keyValue.key.equals("claimValue")){ - sb.append(keyValue.getValue()); - sb.append(","); - } - } - - String claims = sb.toString(); - Assert.assertTrue(claims.contains(firstNameClaimURI)); - Assert.assertTrue(claims.contains(config.getUser().getUsername())); - Assert.assertTrue(claims.contains(emailClaimURI)); - Assert.assertTrue(claims.contains(config.getUser().getEmail())); - } - - private void assertLogin(String results){ - Assert.assertTrue(results.contains("You are logged in as " + - "https://localhost:9853/openid/" + config.getUser().getUsername()), - "OpenId sso login has failed for " + config); - } - - private void assertAttributes(String results){ - String str = results.substring(results.lastIndexOf("")); - - String[] dataArray = StringUtils.substringsBetween(str, ""); - Map attributeMap = new HashMap(); - String key = null; - String value; - for (int i = 0; i< dataArray.length; i++){ - if((i%2) == 0){ - key = dataArray[i]; - }else{ - value = dataArray[i].trim(); - attributeMap.put(key,value); - } - } - - OpenIDUtils.User user = config.getUser(); - - Assert.assertTrue(attributeMap.containsKey("email"), "Claim email is expected"); - Assert.assertEquals(attributeMap.get("email"), user.getEmail(), - "Expected claim value for email is " + user.getEmail()); - Assert.assertTrue(attributeMap.containsKey("nickname"), "Claim nickname is expected"); - Assert.assertEquals(attributeMap.get("nickname"), user.getUsername(), - "Expected claim value for nickname is " + user.getUsername()); - Assert.assertTrue(attributeMap.containsKey("lastname"), "Claim lastname is expected"); - Assert.assertEquals(attributeMap.get("lastname"), user.getUsername(), - "Expected claim value for lastname is " + user.getUsername()); - } - - private void changeISConfiguration() throws Exception { - log.info("Replacing identity.xml with OpenIDSkipUserConsent property set to true"); - - String carbonHome = Utils.getResidentCarbonHome(); - identityXML = new File(carbonHome + File.separator - + "repository" + File.separator + "conf" + File.separator + "identity" +File.separator + "identity.xml"); - File configuredIdentityXML = new File(getISResourceLocation() - + File.separator + "openId" + File.separator - + "identity-skipuserconsent.xml"); - - serverConfigurationManager = new ServerConfigurationManager(isServer); - serverConfigurationManager.applyConfigurationWithoutRestart(configuredIdentityXML, identityXML, true); - serverConfigurationManager.restartGracefully(); - } - - private void resetISConfiguration() throws Exception{ - log.info("Replacing identity.xml with default configurations"); - - File defaultIdentityXML = new File(getISResourceLocation() + File.separator + "default-identity.xml"); - - serverConfigurationManager.applyConfigurationWithoutRestart(defaultIdentityXML, identityXML, true); - serverConfigurationManager.restartGracefully(); - } - - static class KeyValue{ - private String key; - private String value; - - KeyValue(String key, String value) { - this.key = key; - this.value = value; - } - - public String getValue() { - return value; - } - - public String getKey() { - return key; - } - } -} diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/openid/OpenIDUserProfileTestCase.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/openid/OpenIDUserProfileTestCase.java deleted file mode 100644 index 2853b1a5b80..00000000000 --- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/openid/OpenIDUserProfileTestCase.java +++ /dev/null @@ -1,191 +0,0 @@ -/* - *Copyright (c) 2005-2010, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - *WSO2 Inc. 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.identity.integration.test.openid; - -import org.testng.Assert; -import org.testng.annotations.*; -import org.wso2.carbon.identity.provider.openid.stub.dto.OpenIDClaimDTO; -import org.wso2.carbon.identity.provider.openid.stub.dto.OpenIDParameterDTO; -import org.wso2.carbon.identity.provider.openid.stub.dto.OpenIDUserProfileDTO; -import org.wso2.identity.integration.common.clients.openid.OpenIDProviderServiceClient; -import org.wso2.identity.integration.common.clients.usermgt.remote.RemoteUserStoreManagerServiceClient; -import org.wso2.identity.integration.common.utils.ISIntegrationTest; -import org.wso2.carbon.um.ws.api.stub.ClaimValue; - -public class OpenIDUserProfileTestCase extends ISIntegrationTest { - - String userName = "suresh"; - String password = "Wso2@123"; - String[] roles = { "admin" }; - String profileName = "default"; - - // claims - String emailClaimURI = "http://axschema.org/contact/email"; - String emailClaimValue = "suresh@wso2.com"; - String firstNameClaimURI = "http://axschema.org/namePerson/first"; - String firstNameClaimValue = "Suresh"; - String lastNameClaimURI = "http://axschema.org/namePerson/last"; - String lastNameClaimValue = "Attanayake"; - String countryClaimURI = "http://axschema.org/contact/country/home"; - String countryClaimValue = "Sri Lanka"; - - ClaimValue[] claimValues = new ClaimValue[4]; - - private OpenIDProviderServiceClient openidServiceClient; - - @BeforeClass(alwaysRun = true) - public void testInit() throws Exception { - super.init(); - - openidServiceClient = new OpenIDProviderServiceClient(backendURL, sessionCookie); - createUser(); - } - - @AfterClass(alwaysRun = true) - public void atEnd() throws Exception { - super.init(); - deleteUser(); - - openidServiceClient = null; - } - - @Test(alwaysRun = true, description = "Test reading user profile and claims from the profile") - public void testUserProfile() { - - String openId = Util.getDefaultOpenIDIdentifier(userName); - OpenIDParameterDTO[] openidRequestParams = Util.getDummyOpenIDParameterDTOArray(); - - OpenIDUserProfileDTO[] userProfiles = null; - // reading back user profiles - try { - userProfiles = openidServiceClient.getUserProfiles(openId, openidRequestParams); - } catch (Exception e) { - Assert.fail("Error while reading user profiles", e); - } - - Assert.assertEquals(userProfiles[0].getProfileName(), profileName); - Assert.assertNotNull(userProfiles[0].getClaimSet()); - - // we expect 4 claims : email, firstname, lastname and country - Assert.assertEquals(userProfiles[0].getClaimSet().length, 4); - - for (OpenIDClaimDTO claimDTO: userProfiles[0].getClaimSet()){ - if (emailClaimURI.equals(claimDTO.getClaimUri())) { - Assert.assertTrue(claimDTO.getClaimValue().contains(emailClaimValue)); - } else if (firstNameClaimURI.equals(claimDTO.getClaimUri())) { - Assert.assertTrue(claimDTO.getClaimValue().contains(firstNameClaimValue)); - } else if (lastNameClaimURI.equals(claimDTO.getClaimUri())) { - Assert.assertTrue(claimDTO.getClaimValue().contains(lastNameClaimValue)); - } else if (countryClaimURI.equals(claimDTO.getClaimUri())) { - Assert.assertTrue(claimDTO.getClaimValue().contains(countryClaimValue)); - } else { - Assert.fail("Invalid claim returned"); - } - } - - // To access claims for the OpenID user need to have an authenticated session. - // Login with created user - try { - openidServiceClient.authenticateWithOpenID(openId, password); - } catch (Exception e) { - Assert.fail("Error while authenticating", e); - } - } - - @Test(alwaysRun = true, description = "Test OpenID authentication") - public void testOpenIDAuthentication() { - - String openId = Util.getDefaultOpenIDIdentifier(userName); - - boolean isAuthenticated = false; - - try { - isAuthenticated = openidServiceClient.authenticateWithOpenID(openId, password); - } catch (Exception e) { - Assert.fail("Error while authenticating", e); - } - - Assert.assertTrue(isAuthenticated); - } - - @Test(alwaysRun = true, description = "Test reading claims", dependsOnMethods = { "testOpenIDAuthentication" }) - public void testClaims() { - - String openId = Util.getDefaultOpenIDIdentifier(userName); - OpenIDParameterDTO[] openidRequestParams = Util.getDummyOpenIDParameterDTOArray(); - - OpenIDClaimDTO[] claims = null; - try { - // reading back user claims - claims = openidServiceClient.getClaimValues(openId, profileName, openidRequestParams); - } catch (Exception e) { - Assert.fail("Error while reading user claims", e); - } - - // we expect 4 claims : email, firstname, lastname and country - Assert.assertEquals(claims.length, 4); - - // now checking claim values - for (OpenIDClaimDTO dto : claims) { - if (emailClaimURI.equals(dto.getClaimUri())) { - Assert.assertTrue(dto.getClaimValue().contains(emailClaimValue)); - } else if (firstNameClaimURI.equals(dto.getClaimUri())) { - Assert.assertTrue(dto.getClaimValue().contains(firstNameClaimValue)); - } else if (lastNameClaimURI.equals(dto.getClaimUri())) { - Assert.assertTrue(dto.getClaimValue().contains(lastNameClaimValue)); - } else if (countryClaimURI.equals(dto.getClaimUri())) { - Assert.assertTrue(dto.getClaimValue().contains(countryClaimValue)); - } else { - Assert.fail("Invalid claim returned"); - } - } - } - - public void createUser() throws Exception { - ClaimValue email = new ClaimValue(); - email.setClaimURI(emailClaimURI); - email.setValue(emailClaimValue); - claimValues[0] = email; - - ClaimValue firstName = new ClaimValue(); - firstName.setClaimURI(firstNameClaimURI); - firstName.setValue(firstNameClaimValue); - claimValues[1] = firstName; - - ClaimValue lastName = new ClaimValue(); - lastName.setClaimURI(lastNameClaimURI); - lastName.setValue(lastNameClaimValue); - claimValues[2] = lastName; - - ClaimValue country = new ClaimValue(); - country.setClaimURI(countryClaimURI); - country.setValue(countryClaimValue); - claimValues[3] = country; - - // creating the user - RemoteUserStoreManagerServiceClient remoteUSMServiceClient = new RemoteUserStoreManagerServiceClient - (backendURL, sessionCookie); - remoteUSMServiceClient.addUser(userName, password, roles, claimValues, profileName, true); - } - - public void deleteUser() throws Exception { - RemoteUserStoreManagerServiceClient remoteUSMServiceClient = new RemoteUserStoreManagerServiceClient - (backendURL, sessionCookie); - remoteUSMServiceClient.deleteUser(userName); - } -} \ No newline at end of file diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/openid/OpenIDUtils.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/openid/OpenIDUtils.java deleted file mode 100644 index 26518cbcc29..00000000000 --- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/openid/OpenIDUtils.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright (c) 2005-2010, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. 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.identity.integration.test.openid; - -public class OpenIDUtils { - - public enum User { - ADMIN("openidadmin","Wso2@test", "openidadmin@wso2.com", "admin"), - USER1("openiduser1", "Wso2@test1", "openiduser1@wso2.com", "internal/everyone"), - USER2("openiduser2", "Wso2@test2", "openiduser2@wso2.com", "internal/everyone"); - - private String username; - private String password; - private String email; - private String role; - - User(String username, String password, String email, String role) { - this.username = username; - this.password = password; - this.email = email; - this.role = role; - } - - public String getUsername() { - return username; - } - - public String getPassword() { - return password; - } - - public String getEmail() { - return email; - } - - public String getRole() { - return role; - } - }; - - public enum UserConsent{ - APPROVE, - APPROVE_ALWAYS, - SKIP - }; - - public enum AppType{ - SMART_WITH_CLAIMS("travelocity.com-openid-smartconsumerwithclaims"), - SMART_WITHOUT_CLAIMS("travelocity.com-openid-smartconsumerwithoutclaims"), - DUMB_WITH_CLAIMS("travelocity.com-openid-dumbconsumerwithclaims"), - DUMB_WITHOUT_CLAIMS("travelocity.com-openid-dumbconsumerwithoutclaims"); - - private String artifact; - - AppType(String artifact) { - this.artifact = artifact; - } - - public String getArtifact() { - return artifact; - } - } - - public static class OpenIDConfig { - - private User user; - private UserConsent userConsent; - private AppType appType; - - - public OpenIDConfig(User user, UserConsent userConsent, AppType appType) { - this.user = user; - this.userConsent = userConsent; - this.appType = appType; - } - - public User getUser() { - return user; - } - - public UserConsent getUserConsent() { - return userConsent; - } - - public AppType getAppType() { - return appType; - } - - @Override - public String toString() { - return "OpenIdConfig[" + - "user=" + user + - ", userConsent=" + userConsent + - ", appType=" + appType + - ']'; - } - } - -} diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/application/management/v1/ApplicationManagementPassiveStsSuccessTest.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/application/management/v1/ApplicationManagementPassiveStsSuccessTest.java index 5cbd405e7ef..5c394a1fbfc 100644 --- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/application/management/v1/ApplicationManagementPassiveStsSuccessTest.java +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/application/management/v1/ApplicationManagementPassiveStsSuccessTest.java @@ -23,7 +23,6 @@ import org.testng.annotations.Factory; import org.testng.annotations.Test; import org.wso2.carbon.automation.engine.context.TestUserMode; -import org.wso2.identity.integration.test.openid.Util; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.Matchers.notNullValue; 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 8f62633eb32..4e236d65865 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 @@ -77,12 +77,6 @@ - - - - - - @@ -107,7 +101,6 @@ - From f7c4a990db79496cffc589438d0b55033c0ac0dd Mon Sep 17 00:00:00 2001 From: Maduranga Siriwardena Date: Wed, 27 Nov 2024 15:03:48 +0530 Subject: [PATCH 3/4] Remove openid app building --- .../tests-integration/tests-backend/pom.xml | 15 - .../travelocity.properties | 89 ----- .../travelocity.properties | 89 ----- .../IS/openId/identity-skipuserconsent.xml | 320 ------------------ .../artifacts/IS/openId/openid-app-build.xml | 114 ------- .../travelocity.properties | 89 ----- .../travelocity.properties | 89 ----- 7 files changed, 805 deletions(-) delete mode 100644 modules/integration/tests-integration/tests-backend/src/test/resources/artifacts/IS/openId/dumbconsumerwithclaims/travelocity.properties delete mode 100644 modules/integration/tests-integration/tests-backend/src/test/resources/artifacts/IS/openId/dumbconsumerwithoutclaims/travelocity.properties delete mode 100644 modules/integration/tests-integration/tests-backend/src/test/resources/artifacts/IS/openId/identity-skipuserconsent.xml delete mode 100644 modules/integration/tests-integration/tests-backend/src/test/resources/artifacts/IS/openId/openid-app-build.xml delete mode 100644 modules/integration/tests-integration/tests-backend/src/test/resources/artifacts/IS/openId/smartconsumerwithclaims/travelocity.properties delete mode 100644 modules/integration/tests-integration/tests-backend/src/test/resources/artifacts/IS/openId/smartconsumerwithoutclaims/travelocity.properties diff --git a/modules/integration/tests-integration/tests-backend/pom.xml b/modules/integration/tests-integration/tests-backend/pom.xml index ea68c0371e4..51350a63419 100644 --- a/modules/integration/tests-integration/tests-backend/pom.xml +++ b/modules/integration/tests-integration/tests-backend/pom.xml @@ -446,21 +446,6 @@ run - - packaging-war-artifacts-openid - process-test-resources - - - - - - - - - - run - - packaging-war-artifacts-oauth process-test-resources diff --git a/modules/integration/tests-integration/tests-backend/src/test/resources/artifacts/IS/openId/dumbconsumerwithclaims/travelocity.properties b/modules/integration/tests-integration/tests-backend/src/test/resources/artifacts/IS/openId/dumbconsumerwithclaims/travelocity.properties deleted file mode 100644 index cc735665edd..00000000000 --- a/modules/integration/tests-integration/tests-backend/src/test/resources/artifacts/IS/openId/dumbconsumerwithclaims/travelocity.properties +++ /dev/null @@ -1,89 +0,0 @@ -EnableSAML2SSOLogin=true -EnableOpenIDLogin=true -EnableOAuth2SAML2Grant=false - -#Url to do send SAML2 SSO AuthnRequest -SAML2SSOURL=samlsso - -#Url to do initiate OAuth2 SAML2 Grant Request -OAuth2SAML2GrantURL=token - -#Url to initiate OpenID Authentication Request -OpenIdURL=openid - -#URIs to skip SSOAgentFilter; comma separated values -SkipURIs=/travelocity.com-openid-dumbconsumerwithclaims/index.jsp - -#A unique identifier for this SAML 2.0 Service Provider application -SAML2.SPEntityId=travelocity.com-openid-dumbconsumerwithclaims - -#The URL of the SAML 2.0 Assertion Consumer -SAML2.ACSURL=http://localhost:8490/travelocity.com-openid-dumbconsumerwithclaims/home.jsp - -#A unique identifier for this SAML 2.0 Service Provider application -SAML2.IdPEntityId=localhost - -#The URL of the SAML 2.0 Identity Provider -SAML2.IdPURL=https://localhost:9853/samlsso - -#Identifier given for the Service Provider for SAML 2.0 attributes -#exchange -#SAML2.AttributeConsumingServiceIndex=1701087467 - -#Specify if SingleLogout is enabled/disabled -SAML2.EnableSLO=true - -#This is the URL that is used for SLO -SAML2.SLOURL=logout - -#Specify if SAMLResponse element is signed -SAML2.EnableResponseSigning=true - -#Specify if SAMLAssertion element is signed -SAML2.EnableAssertionSigning=true - -#Specify if SAMLAssertion element is encrypted -SAML2.EnableAssertionEncryption=false - -#Specify if AuthnRequests and LogoutRequests should be signed -SAML2.EnableRequestSigning=true - -#Password of the KeyStore for SAML and OpenID -KeyStorePassword=wso2carbon - -#Alias of the IdP's public certificate -IdPPublicCertAlias=wso2carbon - -#Alias of the SP's private key -PrivateKeyAlias=wso2carbon - -#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 - -#OAuth2 Client ID -SAML2.OAuth2ClientId=Qn5DQHCYfshxeZh6R9SL1HM2lsMa - -#OAuth2 Client Secret -SAML2.OAuth2ClientSecret=cbkAs1gajdwPAMbrSR54hPAIcz0a - -#OpenId Provider Url -OpenId.ProviderURL=https://localhost:9853/openid/ - -#openid.return_to parameter -OpenId.ReturnToURL=http://localhost:8490/travelocity.com-openid-dumbconsumerwithclaims/home.jsp - -#Custom SAML post binding request page -#SAML.PostBinding.RequestPage=path/to/the/html - -#Additional request parameters -#SAML.Request.Query.Param=&forceAuth=true - -#Specify whether the consumer requests user attributes from the provider -OpenId.EnableAttributeExchange=true - -#Specify whether the consumer runs in dumb mode -OpenId.EnableDumbMode=true diff --git a/modules/integration/tests-integration/tests-backend/src/test/resources/artifacts/IS/openId/dumbconsumerwithoutclaims/travelocity.properties b/modules/integration/tests-integration/tests-backend/src/test/resources/artifacts/IS/openId/dumbconsumerwithoutclaims/travelocity.properties deleted file mode 100644 index 59adfa26110..00000000000 --- a/modules/integration/tests-integration/tests-backend/src/test/resources/artifacts/IS/openId/dumbconsumerwithoutclaims/travelocity.properties +++ /dev/null @@ -1,89 +0,0 @@ -EnableSAML2SSOLogin=true -EnableOpenIDLogin=true -EnableOAuth2SAML2Grant=false - -#Url to do send SAML2 SSO AuthnRequest -SAML2SSOURL=samlsso - -#Url to do initiate OAuth2 SAML2 Grant Request -OAuth2SAML2GrantURL=token - -#Url to initiate OpenID Authentication Request -OpenIdURL=openid - -#URIs to skip SSOAgentFilter; comma separated values -SkipURIs=/travelocity.com-openid-dumbconsumerwithoutclaims/index.jsp - -#A unique identifier for this SAML 2.0 Service Provider application -SAML2.SPEntityId=travelocity.com-openid-dumbconsumerwithoutclaims - -#The URL of the SAML 2.0 Assertion Consumer -SAML2.ACSURL=http://localhost:8490/travelocity.com-openid-dumbconsumerwithoutclaims/home.jsp - -#A unique identifier for this SAML 2.0 Service Provider application -SAML2.IdPEntityId=localhost - -#The URL of the SAML 2.0 Identity Provider -SAML2.IdPURL=https://localhost:9853/samlsso - -#Identifier given for the Service Provider for SAML 2.0 attributes -#exchange -#SAML2.AttributeConsumingServiceIndex=1701087467 - -#Specify if SingleLogout is enabled/disabled -SAML2.EnableSLO=true - -#This is the URL that is used for SLO -SAML2.SLOURL=logout - -#Specify if SAMLResponse element is signed -SAML2.EnableResponseSigning=true - -#Specify if SAMLAssertion element is signed -SAML2.EnableAssertionSigning=true - -#Specify if SAMLAssertion element is encrypted -SAML2.EnableAssertionEncryption=false - -#Specify if AuthnRequests and LogoutRequests should be signed -SAML2.EnableRequestSigning=true - -#Password of the KeyStore for SAML and OpenID -KeyStorePassword=wso2carbon - -#Alias of the IdP's public certificate -IdPPublicCertAlias=wso2carbon - -#Alias of the SP's private key -PrivateKeyAlias=wso2carbon - -#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 - -#OAuth2 Client ID -SAML2.OAuth2ClientId=Qn5DQHCYfshxeZh6R9SL1HM2lsMa - -#OAuth2 Client Secret -SAML2.OAuth2ClientSecret=cbkAs1gajdwPAMbrSR54hPAIcz0a - -#OpenId Provider Url -OpenId.ProviderURL=https://localhost:9853/openid/ - -#openid.return_to parameter -OpenId.ReturnToURL=http://localhost:8490/travelocity.com-openid-dumbconsumerwithoutclaims/home.jsp - -#Custom SAML post binding request page -#SAML.PostBinding.RequestPage=path/to/the/html - -#Additional request parameters -#SAML.Request.Query.Param=&forceAuth=true - -#Specify whether the consumer requests user attributes from the provider -OpenId.EnableAttributeExchange=false - -#Specify whether the consumer runs in dumb mode -OpenId.EnableDumbMode=true diff --git a/modules/integration/tests-integration/tests-backend/src/test/resources/artifacts/IS/openId/identity-skipuserconsent.xml b/modules/integration/tests-integration/tests-backend/src/test/resources/artifacts/IS/openId/identity-skipuserconsent.xml deleted file mode 100644 index c8b7448a3d4..00000000000 --- a/modules/integration/tests-integration/tests-backend/src/test/resources/artifacts/IS/openId/identity-skipuserconsent.xml +++ /dev/null @@ -1,320 +0,0 @@ - - - - - - - - - jdbc/WSO2CarbonDB - - - - - - - - - ${carbon.home}/repository/resources/security/userRP.p12 - - - PKCS12 - - wso2carbon - - wso2carbon - - - - ${carbon.home}/conf/keystores - - - - SelfAndManaged - CertValidate - - - - - - - - - - https://localhost:9853/openidserver - https://localhost:9853/openid/ - - true - - 7200 - - false - - false - - 36000 - - false - org.wso2.carbon.identity.provider.openid.claims.DefaultClaimsRetriever - - - - https://localhost:9853/oauth/request-token - https://localhost:9853/oauth/access-token - https://localhost:9853/oauth/authorize-url - - 300 - - 3600 - - 3600 - - 84600 - - 300 - - true - - true - - org.wso2.carbon.identity.oauth.tokenprocessor.PlainTextPersistenceProcessor - - - org.wso2.carbon.identity.oauth2.token.handlers.clientauth.BasicAuthClientAuthHandler - - - - - token - org.wso2.carbon.identity.oauth2.authz.handlers.TokenResponseTypeHandler - - - code - org.wso2.carbon.identity.oauth2.authz.handlers.CodeResponseTypeHandler - - - - - - authorization_code - org.wso2.carbon.identity.oauth2.token.handlers.grant.AuthorizationCodeGrantHandler - - - password - org.wso2.carbon.identity.oauth2.token.handlers.grant.PasswordGrantHandler - - - refresh_token - org.wso2.carbon.identity.oauth2.token.handlers.grant.RefreshGrantHandler - - - client_credentials - org.wso2.carbon.identity.oauth2.token.handlers.grant.ClientCredentialsGrantHandler - - - urn:ietf:params:oauth:grant-type:saml2-bearer - org.wso2.carbon.identity.oauth2.token.handlers.grant.saml.SAML2BearerGrantHandler - - - iwa:ntlm - org.wso2.carbon.identity.oauth2.token.handlers.grant.iwa.ntlm.NTLMAuthenticationGrantHandler - - - - - - - - - false - - - - false - - - - - false - org.wso2.carbon.identity.oauth2.authcontext.JWTTokenGenerator - org.wso2.carbon.identity.oauth2.authcontext.DefaultClaimsRetriever - http://wso2.org/claims - SHA256withRSA - 15 - - - - - - org.wso2.carbon.identity.openidconnect.DefaultIDTokenBuilder - https://localhost:9853/oauth2endpoints/token - http://wso2.org/claims/givenname - org.wso2.carbon.identity.openidconnect.SAMLAssertionClaimsCallback - 3600 - http://wso2.org/claims - org.wso2.carbon.identity.oauth.endpoint.user.impl.UserInfoUserStoreClaimRetriever - org.wso2.carbon.identity.oauth.endpoint.user.impl.UserInforRequestDefaultValidator - org.wso2.carbon.identity.oauth.endpoint.user.impl.UserInfoISAccessTokenValidator - org.wso2.carbon.identity.oauth.endpoint.user.impl.UserInfoJSONResponseBuilder - false - - - - - true - 0 - 5 - - - - - - - - - - - gtalk - talk.google.com - 5222 - gmail.com - multifactor1@gmail.com - wso2carbon - - - - - - localhost - https://localhost:9853/samlsso - 5 - 60000 - false - 36000 - - org.wso2.carbon.identity.sso.saml.attributes.UserAttributeStatementBuilder - http://wso2.org/claims - false - org.wso2.carbon.identity.sso.saml.builders.claims.DefaultClaimsRetriever - org.wso2.carbon.identity.sso.saml.builders.encryption.DefaultSSOEncrypter - org.wso2.carbon.identity.sso.saml.builders.signature.DefaultSSOSigner - org.wso2.carbon.identity.sso.saml.validators.SAML2HTTPRedirectDeflateSignatureValidator - - - - 5 - false - - - - - - - true - 36000 - - - true - - - true - - ${Ports.ThriftEntitlementReceivePort} - 10000 - - ${carbon.home}/repository/resources/security/wso2carbon.p12 - wso2carbon - - - - - - - - true - - - true - - true - - - - true - true - ! - 2 - - false - 3 - - - - 3 - true - - false - false - true - - - - - true - true - - true - - - - - true - true - - true - - false - - - - - - 5 - - - 10 - local://services - - - - diff --git a/modules/integration/tests-integration/tests-backend/src/test/resources/artifacts/IS/openId/openid-app-build.xml b/modules/integration/tests-integration/tests-backend/src/test/resources/artifacts/IS/openId/openid-app-build.xml deleted file mode 100644 index d4adb66c448..00000000000 --- a/modules/integration/tests-integration/tests-backend/src/test/resources/artifacts/IS/openId/openid-app-build.xml +++ /dev/null @@ -1,114 +0,0 @@ - - - - - - This script builds four war files for the travelocity app for combinations of consumer type and openid attribute - exchange - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/modules/integration/tests-integration/tests-backend/src/test/resources/artifacts/IS/openId/smartconsumerwithclaims/travelocity.properties b/modules/integration/tests-integration/tests-backend/src/test/resources/artifacts/IS/openId/smartconsumerwithclaims/travelocity.properties deleted file mode 100644 index 5169535a44d..00000000000 --- a/modules/integration/tests-integration/tests-backend/src/test/resources/artifacts/IS/openId/smartconsumerwithclaims/travelocity.properties +++ /dev/null @@ -1,89 +0,0 @@ -EnableSAML2SSOLogin=true -EnableOpenIDLogin=true -EnableOAuth2SAML2Grant=false - -#Url to do send SAML2 SSO AuthnRequest -SAML2SSOURL=samlsso - -#Url to do initiate OAuth2 SAML2 Grant Request -OAuth2SAML2GrantURL=token - -#Url to initiate OpenID Authentication Request -OpenIdURL=openid - -#URIs to skip SSOAgentFilter; comma separated values -SkipURIs=/travelocity.com-openid-smartconsumerwithclaims/index.jsp - -#A unique identifier for this SAML 2.0 Service Provider application -SAML2.SPEntityId=travelocity.com-openid-smartconsumerwithclaims - -#The URL of the SAML 2.0 Assertion Consumer -SAML2.ACSURL=http://localhost:8490/travelocity.com-openid-smartconsumerwithclaims/home.jsp - -#A unique identifier for this SAML 2.0 Service Provider application -SAML2.IdPEntityId=localhost - -#The URL of the SAML 2.0 Identity Provider -SAML2.IdPURL=https://localhost:9853/samlsso - -#Identifier given for the Service Provider for SAML 2.0 attributes -#exchange -#SAML2.AttributeConsumingServiceIndex=1701087467 - -#Specify if SingleLogout is enabled/disabled -SAML2.EnableSLO=true - -#This is the URL that is used for SLO -SAML2.SLOURL=logout - -#Specify if SAMLResponse element is signed -SAML2.EnableResponseSigning=true - -#Specify if SAMLAssertion element is signed -SAML2.EnableAssertionSigning=true - -#Specify if SAMLAssertion element is encrypted -SAML2.EnableAssertionEncryption=false - -#Specify if AuthnRequests and LogoutRequests should be signed -SAML2.EnableRequestSigning=true - -#Password of the KeyStore for SAML and OpenID -KeyStorePassword=wso2carbon - -#Alias of the IdP's public certificate -IdPPublicCertAlias=wso2carbon - -#Alias of the SP's private key -PrivateKeyAlias=wso2carbon - -#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 - -#OAuth2 Client ID -SAML2.OAuth2ClientId=Qn5DQHCYfshxeZh6R9SL1HM2lsMa - -#OAuth2 Client Secret -SAML2.OAuth2ClientSecret=cbkAs1gajdwPAMbrSR54hPAIcz0a - -#OpenId Provider Url -OpenId.ProviderURL=https://localhost:9853/openid/ - -#openid.return_to parameter -OpenId.ReturnToURL=http://localhost:8490/travelocity.com-openid-smartconsumerwithclaims/home.jsp - -#Custom SAML post binding request page -#SAML.PostBinding.RequestPage=path/to/the/html - -#Additional request parameters -#SAML.Request.Query.Param=&forceAuth=true - -#Specify whether the consumer requests user attributes from the provider -OpenId.EnableAttributeExchange=true - -#Specify whether the consumer runs in dumb mode -OpenId.EnableDumbMode=false diff --git a/modules/integration/tests-integration/tests-backend/src/test/resources/artifacts/IS/openId/smartconsumerwithoutclaims/travelocity.properties b/modules/integration/tests-integration/tests-backend/src/test/resources/artifacts/IS/openId/smartconsumerwithoutclaims/travelocity.properties deleted file mode 100644 index c379912c713..00000000000 --- a/modules/integration/tests-integration/tests-backend/src/test/resources/artifacts/IS/openId/smartconsumerwithoutclaims/travelocity.properties +++ /dev/null @@ -1,89 +0,0 @@ -EnableSAML2SSOLogin=true -EnableOpenIDLogin=true -EnableOAuth2SAML2Grant=false - -#Url to do send SAML2 SSO AuthnRequest -SAML2SSOURL=samlsso - -#Url to do initiate OAuth2 SAML2 Grant Request -OAuth2SAML2GrantURL=token - -#Url to initiate OpenID Authentication Request -OpenIdURL=openid - -#URIs to skip SSOAgentFilter; comma separated values -SkipURIs=/travelocity.com-openid-smartconsumerwithoutclaims/index.jsp - -#A unique identifier for this SAML 2.0 Service Provider application -SAML2.SPEntityId=travelocity.com-openid-smartconsumerwithoutclaims - -#The URL of the SAML 2.0 Assertion Consumer -SAML2.ACSURL=http://localhost:8490/travelocity.com-openid-smartconsumerwithoutclaims/home.jsp - -#A unique identifier for this SAML 2.0 Service Provider application -SAML2.IdPEntityId=localhost - -#The URL of the SAML 2.0 Identity Provider -SAML2.IdPURL=https://localhost:9853/samlsso - -#Identifier given for the Service Provider for SAML 2.0 attributes -#exchange -#SAML2.AttributeConsumingServiceIndex=1701087467 - -#Specify if SingleLogout is enabled/disabled -SAML2.EnableSLO=true - -#This is the URL that is used for SLO -SAML2.SLOURL=logout - -#Specify if SAMLResponse element is signed -SAML2.EnableResponseSigning=true - -#Specify if SAMLAssertion element is signed -SAML2.EnableAssertionSigning=true - -#Specify if SAMLAssertion element is encrypted -SAML2.EnableAssertionEncryption=false - -#Specify if AuthnRequests and LogoutRequests should be signed -SAML2.EnableRequestSigning=true - -#Password of the KeyStore for SAML and OpenID -KeyStorePassword=wso2carbon - -#Alias of the IdP's public certificate -IdPPublicCertAlias=wso2carbon - -#Alias of the SP's private key -PrivateKeyAlias=wso2carbon - -#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 - -#OAuth2 Client ID -SAML2.OAuth2ClientId=Qn5DQHCYfshxeZh6R9SL1HM2lsMa - -#OAuth2 Client Secret -SAML2.OAuth2ClientSecret=cbkAs1gajdwPAMbrSR54hPAIcz0a - -#OpenId Provider Url -OpenId.ProviderURL=https://localhost:9853/openid/ - -#openid.return_to parameter -OpenId.ReturnToURL=http://localhost:8490/travelocity.com-openid-smartconsumerwithoutclaims/home.jsp - -#Custom SAML post binding request page -#SAML.PostBinding.RequestPage=path/to/the/html - -#Additional request parameters -#SAML.Request.Query.Param=&forceAuth=true - -#Specify whether the consumer requests user attributes from the provider -OpenId.EnableAttributeExchange=false - -#Specify whether the consumer runs in dumb mode -OpenId.EnableDumbMode=false From 2a89cfe6756601f2fba2ada8e7c6fc189257e908 Mon Sep 17 00:00:00 2001 From: Maduranga Siriwardena Date: Wed, 27 Nov 2024 15:06:44 +0530 Subject: [PATCH 4/4] Remove util --- .../integration/test/openid/Util.java | 121 ------------------ 1 file changed, 121 deletions(-) delete mode 100644 modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/openid/Util.java diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/openid/Util.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/openid/Util.java deleted file mode 100644 index 7968426da87..00000000000 --- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/openid/Util.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright (c) 2005-2010, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. 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.identity.integration.test.openid; - - -import org.wso2.carbon.identity.provider.openid.stub.dto.OpenIDParameterDTO; - -public class Util { - - public static String openidUserIDBase = "https://localhost:9853/openid/"; - - /** - * Return the OpenID Identifier of the username - * - * @param username - * @return - */ - public static String getDefaultOpenIDIdentifier(String username) { - return openidUserIDBase.concat(username); - } - - /** - * Returns a dummy request with four claims requests : firstname, lastname, - * country and email. - * - * @return - */ - public static OpenIDParameterDTO[] getDummyOpenIDParameterDTOArray() { - - OpenIDParameterDTO[] openidParams = new OpenIDParameterDTO[14]; - - OpenIDParameterDTO ext1 = new OpenIDParameterDTO(); - ext1.setName("openid.ns.ext1"); - ext1.setValue("http://openid.net/srv/ax/1.0"); - openidParams[0] = ext1; - - OpenIDParameterDTO claimedID = new OpenIDParameterDTO(); - claimedID.setName("openid.claimed_id"); - claimedID.setValue("https://localhost:9853/openid/suresh"); - openidParams[1] = claimedID; - - OpenIDParameterDTO required = new OpenIDParameterDTO(); - required.setName("openid.ext1.required"); - required.setValue("email,firstname,lastname,country"); - openidParams[2] = required; - - OpenIDParameterDTO handle = new OpenIDParameterDTO(); - handle.setName("openid.assoc_handle"); - handle.setValue("32471379494934315-1"); - openidParams[3] = handle; - - OpenIDParameterDTO lastname = new OpenIDParameterDTO(); - lastname.setName("openid.ext1.type.lastname"); - lastname.setValue("http://axschema.org/namePerson/last"); - openidParams[4] = lastname; - - OpenIDParameterDTO ns = new OpenIDParameterDTO(); - ns.setName("openid.ns"); - ns.setValue("http://specs.openid.net/auth/2.0"); - openidParams[5] = ns; - - OpenIDParameterDTO firstname = new OpenIDParameterDTO(); - firstname.setName("openid.ext1.type.firstname"); - firstname.setValue("http://axschema.org/namePerson/first"); - openidParams[6] = firstname; - - OpenIDParameterDTO identity = new OpenIDParameterDTO(); - identity.setName("openid.identity"); - identity.setValue("https://localhost:9853/openid/suresh"); - openidParams[7] = identity; - - OpenIDParameterDTO email = new OpenIDParameterDTO(); - email.setName("openid.ext1.type.email"); - email.setValue("http://axschema.org/contact/email"); - openidParams[8] = email; - - OpenIDParameterDTO mode = new OpenIDParameterDTO(); - mode.setName("openid.mode"); - mode.setValue("checkid_setup"); - openidParams[9] = mode; - - OpenIDParameterDTO extMode = new OpenIDParameterDTO(); - extMode.setName("openid.ext1.mode"); - extMode.setValue("fetch_request"); - openidParams[10] = extMode; - - OpenIDParameterDTO realm = new OpenIDParameterDTO(); - realm.setName("openid.realm"); - realm.setValue("http://localhost:8490/openid-client"); - openidParams[11] = realm; - - OpenIDParameterDTO country = new OpenIDParameterDTO(); - country.setName("openid.ext1.type.country"); - country.setValue("http://axschema.org/contact/country/home"); - openidParams[12] = country; - - OpenIDParameterDTO returnto = new OpenIDParameterDTO(); - returnto.setName("openid.return_to"); - returnto.setValue("http://localhost:8490/openid-client/"); - openidParams[13] = returnto; - - return openidParams; - - } - -}
", "