diff --git a/modules/api-resources/api-resources-full/pom.xml b/modules/api-resources/api-resources-full/pom.xml index 7994b618cf5..bbc14c08e4a 100644 --- a/modules/api-resources/api-resources-full/pom.xml +++ b/modules/api-resources/api-resources-full/pom.xml @@ -501,5 +501,13 @@ org.wso2.carbon.identity.server.api org.wso2.carbon.identity.api.server.organization.configs.common + + org.wso2.carbon.identity.server.api + org.wso2.carbon.identity.api.server.organization.selfservice.v1 + + + org.wso2.carbon.identity.server.api + org.wso2.carbon.identity.api.server.organization.selfservice.common + diff --git a/modules/api-resources/api-resources-full/src/main/webapp/WEB-INF/beans.xml b/modules/api-resources/api-resources-full/src/main/webapp/WEB-INF/beans.xml index 4a2e1121bd2..10adb40df23 100644 --- a/modules/api-resources/api-resources-full/src/main/webapp/WEB-INF/beans.xml +++ b/modules/api-resources/api-resources-full/src/main/webapp/WEB-INF/beans.xml @@ -60,6 +60,7 @@ + @@ -123,6 +124,7 @@ + diff --git a/modules/api-resources/pom.xml b/modules/api-resources/pom.xml index d4b65e33b53..60eadcd4c58 100644 --- a/modules/api-resources/pom.xml +++ b/modules/api-resources/pom.xml @@ -495,6 +495,16 @@ org.wso2.carbon.identity.api.server.organization.configs.common ${identity.server.api.version} + + org.wso2.carbon.identity.server.api + org.wso2.carbon.identity.api.server.organization.selfservice.v1 + ${identity.server.api.version} + + + org.wso2.carbon.identity.server.api + org.wso2.carbon.identity.api.server.organization.selfservice.common + ${identity.server.api.version} + org.wso2.carbon.identity.server.api org.wso2.carbon.identity.api.expired.password.identification.v1 diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/identity/mgt/AccountLockEnabledTestCase.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/identity/mgt/AccountLockEnabledTestCase.java index 43ef33a50c2..5d8195bf9ec 100644 --- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/identity/mgt/AccountLockEnabledTestCase.java +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/identity/mgt/AccountLockEnabledTestCase.java @@ -25,31 +25,22 @@ import org.json.simple.JSONObject; import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeClass; -import org.testng.annotations.DataProvider; import org.testng.annotations.Test; import org.wso2.carbon.automation.engine.annotations.ExecutionEnvironment; import org.wso2.carbon.automation.engine.annotations.SetEnvironment; import org.wso2.carbon.automation.test.utils.common.TestConfigurationProvider; -import org.wso2.carbon.automation.test.utils.dbutils.H2DataBaseManager; -import org.wso2.carbon.integration.common.utils.mgt.ServerConfigurationManager; import org.wso2.identity.integration.common.utils.ISIntegrationTest; import org.wso2.identity.integration.test.rest.api.server.identity.governance.v1.dto.ConnectorsPatchReq; import org.wso2.identity.integration.test.rest.api.server.identity.governance.v1.dto.ConnectorsPatchReq.OperationEnum; import org.wso2.identity.integration.test.rest.api.server.identity.governance.v1.dto.PropertyReq; -import org.wso2.identity.integration.test.rest.api.server.user.store.v1.model.UserStoreReq; import org.wso2.identity.integration.test.rest.api.user.common.model.ListObject; import org.wso2.identity.integration.test.rest.api.user.common.model.PatchOperationRequestObject; import org.wso2.identity.integration.test.rest.api.user.common.model.RoleItemAddGroupobj; -import org.wso2.identity.integration.test.rest.api.user.common.model.RoleRequestObject; import org.wso2.identity.integration.test.rest.api.user.common.model.UserObject; import org.wso2.identity.integration.test.restclients.AuthenticatorRestClient; import org.wso2.identity.integration.test.restclients.EmailTemplatesRestClient; import org.wso2.identity.integration.test.restclients.IdentityGovernanceRestClient; import org.wso2.identity.integration.test.restclients.SCIM2RestClient; -import org.wso2.identity.integration.test.restclients.UserStoreMgtRestClient; - -import java.io.File; -import java.io.IOException; public class AccountLockEnabledTestCase extends ISIntegrationTest { @@ -62,17 +53,7 @@ public class AccountLockEnabledTestCase extends ISIntegrationTest { private static final String TEST_LOCK_USER_2_PASSWORD = "TestLockUser2Password"; private static final String TEST_LOCK_USER_3 = "TestLockUser3"; private static final String TEST_LOCK_USER_3_PASSWORD = "TestLockUser3Password"; - private static final String USER_STORE_DB_NAME = "SECONDARY_USER_STORE_DB"; - private static final String USER_STORE_TYPE = "VW5pcXVlSURKREJDVXNlclN0b3JlTWFuYWdlcg"; - private static final String DB_USER_NAME = "wso2automation"; - private static final String DB_USER_PASSWORD = "wso2automation"; - private static final String DOMAIN_ID = "WSO2TEST.COM"; - private static final String TEST_LOCK_USER_SECONDARY = "TestLockUserSecondary"; - private static final String TEST_LOCK_USER_SECONDARY_PASSWORD = "TestLockUserSecondaryPassword"; - private static final String TEST_LOCK_USER_SECONDARY_WRONG_PASSWORD = "TestLockUserSecondaryWrongPassword"; - private static final String PRIMARY_USER_ROLE = "PRIMARY_USER_ROLE"; - private static final String SECONDARY_USER_ROLE = "SECONDARY_USER_ROLE"; - private static final String PERMISSION_LOGIN = "/permission/admin/login"; + private static final String ACCOUNT_LOCK_TEMPLATE_WHEN_USER_EXCEEDS_FAILED_ATTEMPTS = "accountlockfailedattempt"; private static final String ACCOUNT_LOCK_TEMPLATE_WHEN_ADMIN_TRIGGERED = "accountlockadmin"; private static final String ACCOUNT_UNLOCK_TEMPLATE_ADMIN_TRIGGERED = "accountunlockadmin"; @@ -91,28 +72,16 @@ public class AccountLockEnabledTestCase extends ISIntegrationTest { private EmailTemplatesRestClient emailTemplatesRestClient; private IdentityGovernanceRestClient identityGovernanceRestClient; private ConnectorsPatchReq connectorPatchRequest; - private UserStoreMgtRestClient userStoreMgtRestClient; + private String testLockUserId; private String testLockUser2Id; private String testLockUser3Id; - private String testLockRoleId; - private String userStoreId; - - @DataProvider(name = "userDetailsProvider") - public Object[][] getUserDetails() { - return new Object[][]{ - {TEST_LOCK_USER_1, TEST_LOCK_USER_1_PASSWORD, TEST_LOCK_USER_1_WRONG_PASSWORD, false}, - {TEST_LOCK_USER_SECONDARY, TEST_LOCK_USER_SECONDARY_PASSWORD, TEST_LOCK_USER_SECONDARY_WRONG_PASSWORD, true} - }; - } @SetEnvironment(executionEnvironments = {ExecutionEnvironment.ALL}) @BeforeClass(alwaysRun = true) public void testInit() throws Exception { super.init(); - userStoreMgtRestClient = new UserStoreMgtRestClient(serverURL, tenantInfo); - addSecondaryJDBCUserStore(); authenticatorRestClient = new AuthenticatorRestClient(serverURL); enableAccountLocking(); scim2RestClient = new SCIM2RestClient(serverURL, tenantInfo); @@ -120,41 +89,26 @@ public void testInit() throws Exception { } @SetEnvironment(executionEnvironments = {ExecutionEnvironment.ALL}) - @Test(groups = "wso2.is", description = "Check whether the user account lock successfully", dataProvider = "userDetailsProvider") - public void testSuccessfulLockedInitially(String username, String password, String wrongPassword, - boolean isSecondaryUserStore) throws IOException { - + @Test(groups = "wso2.is", description = "Check whether the user account lock successfully") + public void testSuccessfulLockedInitially() { try { - addUserIntoJDBCUserStore(username, password, isSecondaryUserStore); + testLockUserId = addAdminUser(TEST_LOCK_USER_1, TEST_LOCK_USER_1_PASSWORD, null); int maximumAllowedFailedLogins = 5; - for (int i = 0; i < maximumAllowedFailedLogins - 1; i++) { - JSONObject response = authenticatorRestClient.login(username, wrongPassword); + for (int i = 0; i < maximumAllowedFailedLogins; i++) { + JSONObject response = authenticatorRestClient.login(TEST_LOCK_USER_1, TEST_LOCK_USER_1_WRONG_PASSWORD); if (!response.containsKey("token")) { - log.error("Login attempt: " + (i + 1) + " for user: " + username + " failed"); + log.error("Login attempt: " + i + " for user: " + TEST_LOCK_USER_1 + " failed"); } } - // Check whether the user is locked before the maximum allowed failed login attempts. + + JSONObject userParameters = (JSONObject) scim2RestClient.getUser(testLockUserId, null).get(USER_SCHEMA); - Assert.assertFalse(Boolean.parseBoolean(String.valueOf(userParameters.get(ACCOUNT_LOCK_ATTRIBUTE))), - "Test Failure : User is Locked before the maximum allowed failed login attempts"); - - // Check whether the user is locked after the maximum allowed failed login attempts. - JSONObject response = authenticatorRestClient.login(username, wrongPassword); - if (!response.containsKey("token")) { - log.error( - "Login attempt: " + maximumAllowedFailedLogins + " for user: " + username + " failed"); - } - userParameters = (JSONObject) scim2RestClient.getUser(testLockUserId, null).get(USER_SCHEMA); - Assert.assertTrue(Boolean.parseBoolean(String.valueOf(userParameters.get(ACCOUNT_LOCK_ATTRIBUTE))), + Assert.assertTrue((Boolean) userParameters.get(ACCOUNT_LOCK_ATTRIBUTE), "Test Failure : User Account Didn't Locked Properly"); } catch (Exception e) { log.error("Error occurred when locking the test user.", e); - Assert.fail("Error occurred when locking the test user."); - } finally { - scim2RestClient.deleteUser(testLockUserId); - scim2RestClient.deleteRole(testLockRoleId); } } @@ -202,6 +156,7 @@ public void testSuccessfulEmailTemplateRetrievalAccountUnLock() throws Exception @SetEnvironment(executionEnvironments = {ExecutionEnvironment.ALL}) @AfterClass(alwaysRun = true) public void atEnd() throws Exception { + scim2RestClient.deleteUser(testLockUserId); scim2RestClient.deleteUser(testLockUser2Id); scim2RestClient.deleteUser(testLockUser3Id); disableAccountLocking(); @@ -209,7 +164,6 @@ public void atEnd() throws Exception { identityGovernanceRestClient.closeHttpClient(); scim2RestClient.closeHttpClient(); authenticatorRestClient.closeHttpClient(); - userStoreMgtRestClient.deleteUserStore(userStoreId); } protected String getISResourceLocation() { @@ -237,30 +191,7 @@ protected void disableAccountLocking() throws Exception { connectorPatchRequest); } - private void addUserIntoJDBCUserStore(String username, String password, boolean isSecondaryStoreUser) - throws Exception { - - if (isSecondaryStoreUser) { - testLockUserId = scim2RestClient.createUser(new UserObject() - .userName(DOMAIN_ID + "/" + username) - .password(password)); - testLockRoleId = scim2RestClient.addRole(new RoleRequestObject() - .displayName(SECONDARY_USER_ROLE) - .addPermissions(PERMISSION_LOGIN) - .addUsers(new ListObject().value(testLockUserId))); - } else { - testLockUserId = scim2RestClient.createUser(new UserObject() - .userName(username) - .password(password)); - testLockRoleId = scim2RestClient.addRole(new RoleRequestObject() - .displayName(PRIMARY_USER_ROLE) - .addPermissions(PERMISSION_LOGIN) - .addUsers(new ListObject().value(testLockUserId))); - } - } - protected String addAdminUser(String username, String password, String locale) throws Exception { - UserObject userInfo = new UserObject(); userInfo.setUserName(username); userInfo.setPassword(password); @@ -277,59 +208,4 @@ protected String addAdminUser(String username, String password, String locale) t scim2RestClient.updateUserRole(new PatchOperationRequestObject().addOperations(patchRoleItem), roleId); return userId; } - - private void addSecondaryJDBCUserStore() throws Exception { - - // Creating database. - H2DataBaseManager dbmanager = new H2DataBaseManager("jdbc:h2:" + ServerConfigurationManager.getCarbonHome() - + "/repository/database/" + USER_STORE_DB_NAME, DB_USER_NAME, DB_USER_PASSWORD); - dbmanager.executeUpdate(new File(ServerConfigurationManager.getCarbonHome() + "/dbscripts/h2.sql")); - dbmanager.disconnect(); - - // Register a secondary user store. - UserStoreReq userStore = new UserStoreReq() - .typeId(USER_STORE_TYPE) - .name(DOMAIN_ID) - .addPropertiesItem(new UserStoreReq.Property() - .name("driverName") - .value("org.h2.Driver")) - .addPropertiesItem(new UserStoreReq.Property() - .name("url") - .value("jdbc:h2:./repository/database/" + USER_STORE_DB_NAME)) - .addPropertiesItem(new UserStoreReq.Property() - .name("userName") - .value(DB_USER_NAME)) - .addPropertiesItem(new UserStoreReq.Property() - .name("password") - .value(DB_USER_PASSWORD)) - .addPropertiesItem(new UserStoreReq.Property() - .name("PasswordJavaRegEx") - .value("^[\\S]{5,30}$")) - .addPropertiesItem(new UserStoreReq.Property() - .name("UsernameJavaRegEx") - .value("^[\\S]{5,30}$")) - .addPropertiesItem(new UserStoreReq.Property() - .name("Disabled") - .value("false")) - .addPropertiesItem(new UserStoreReq.Property() - .name("PasswordDigest") - .value("SHA-256")) - .addPropertiesItem(new UserStoreReq.Property() - .name("StoreSaltedPassword") - .value("true")) - .addPropertiesItem(new UserStoreReq.Property() - .name("SCIMEnabled") - .value("true")) - .addPropertiesItem(new UserStoreReq.Property() - .name("CountRetrieverClass") - .value("org.wso2.carbon.identity.user.store.count.jdbc.JDBCUserStoreCountRetriever")) - .addPropertiesItem(new UserStoreReq.Property() - .name("UserIDEnabled") - .value("true")); - - userStoreId = userStoreMgtRestClient.addUserStore(userStore); - Thread.sleep(5000); - boolean isSecondaryUserStoreDeployed = userStoreMgtRestClient.waitForUserStoreDeployment(DOMAIN_ID); - Assert.assertTrue(isSecondaryUserStoreDeployed); - } } diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/email/template/v1/EmailTemplatesPositiveTest.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/email/template/v1/EmailTemplatesPositiveTest.java index 85daaf70b46..d70fdb5b9ce 100644 --- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/email/template/v1/EmailTemplatesPositiveTest.java +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/email/template/v1/EmailTemplatesPositiveTest.java @@ -158,7 +158,7 @@ public void testGetAllEmailTemplateTypesWithRequiredAttribute() throws Exception .body(baseIdentifier + "displayName", equalTo("AccountConfirmation")) .body(baseIdentifier + "templates", notNullValue()) .body(baseIdentifier + "templates.find{ it.id == 'en_US' }." + "subject", - equalTo("WSO2 - Account Confirmation")); + equalTo("Confirm your account")); } // Get the list of templates of the default AccountEnable email template type diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/organization/management/v1/OrganizationManagementBaseTest.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/organization/management/v1/OrganizationManagementBaseTest.java index 09027596e68..2a1f2347a63 100644 --- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/organization/management/v1/OrganizationManagementBaseTest.java +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/organization/management/v1/OrganizationManagementBaseTest.java @@ -156,7 +156,7 @@ private String createBaseOrg() { " \"name\": \"ABC Builders\",\n" + " \"description\": \"Building constructions\",\n" + " \"type\": \"TENANT\",\n" + - " \"parentId\": \"Super\",\n" + + " \"parentId\": \"10084a8d-113f-4211-a0d5-efe36b082211\",\n" + " \"attributes\": [\n" + " {\n" + " \"key\": \"Country\",\n" + diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/organization/management/v1/OrganizationManagementSuccessTest.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/organization/management/v1/OrganizationManagementSuccessTest.java index df59a76377a..e8d1d62a1f1 100644 --- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/organization/management/v1/OrganizationManagementSuccessTest.java +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/organization/management/v1/OrganizationManagementSuccessTest.java @@ -72,7 +72,7 @@ public void createOrganization() throws Exception { if (OrganizationLevel.SUPER_ORGANIZATION.equals(this.organizationLevel)) { org = "Level1Org"; - parentId = SUPER_ORGANIZATION_NAME; + parentId = SUPER_ORGANIZATION_ID; } else { org = "Level2Org"; parentId = subOrganizationId; diff --git a/pom.xml b/pom.xml index 22f4b317c19..e86fb81ab4b 100755 --- a/pom.xml +++ b/pom.xml @@ -2320,7 +2320,7 @@ 5.11.26 - 6.11.147 + 6.11.152 5.9.5 5.10.17 5.7.4 @@ -2346,7 +2346,7 @@ 1.8.12 - 1.7.18 + 1.7.19 @@ -2358,7 +2358,7 @@ 4.5.x_1.0.14 - 5.11.18 + 5.11.19 1.0.11 5.5.0 5.8.6 @@ -2378,8 +2378,8 @@ 2.0.3 - 6.7.26 - 5.3.40 + 6.7.27 + 5.3.41 5.4.2 @@ -2393,20 +2393,20 @@ 1.7.7 - 3.3.16 + 3.3.17 0.0.15 2.1.2 3.3.12 1.1.12 4.1.18 - 1.0.4 + 1.0.5 1.1.1 3.1.11 1.0.14 1.0.0 - 1.3.79 - 1.0.70 + 1.3.82 + 1.0.73 1.1.22 1.1.10 @@ -2419,7 +2419,7 @@ 2.0.13 1.3.23 - 1.2.93 + 1.2.95 5.5.9 5.5.7