Search in sources :

Example 21 with UserManagementClient

use of org.wso2.carbon.integration.common.admin.client.UserManagementClient in project product-is by wso2.

the class NotificationOnUserOperationTestCase method testInit.

@BeforeClass(alwaysRun = true)
public void testInit() throws Exception {
    super.init();
    userMgtServiceClient = new UserManagementClient(backendURL, sessionCookie);
    userMgtServiceClient.addUser("NotificationUser", "passWord1@", new String[] { "admin" }, "default");
    userMgtServiceClient.addRole("NotificationRole", new String[] {}, new String[] { "admin" });
    changeISConfiguration();
    super.init();
    userMgtServiceClient = new UserManagementClient(backendURL, sessionCookie);
}
Also used : UserManagementClient(org.wso2.identity.integration.common.clients.UserManagementClient) BeforeClass(org.testng.annotations.BeforeClass)

Example 22 with UserManagementClient

use of org.wso2.carbon.integration.common.admin.client.UserManagementClient in project product-is by wso2.

the class UserProfileAdminTestCase method testUserAccountAssociationAdd.

@Test(priority = 4, groups = "wso2.is", description = "Check Fed User Account Association")
public void testUserAccountAssociationAdd() throws Exception {
    super.init();
    userProfileMgtClient = new UserProfileMgtServiceClient(backendURL, sessionCookie);
    userMgtClient = new UserManagementClient(backendURL, sessionCookie);
    String username = "testUser2";
    String password = "passWord1@";
    String idpName = "idp1";
    // create a user
    userMgtClient.addUser(username, password, new String[] { "admin" }, "default");
    Assert.assertTrue(userMgtClient.getUserList().contains(username));
    idpMgtClient = new IdentityProviderMgtServiceClient(username, password, backendURL);
    userProfileMgtClient = new UserProfileMgtServiceClient(backendURL, username, password);
    IdentityProvider idp = new IdentityProvider();
    idp.setIdentityProviderName(idpName);
    idpMgtClient.addIdP(idp);
    Assert.assertNotNull(idpMgtClient.getIdPByName(idpName));
    // create a federated user account association
    userProfileMgtClient.addFedIdpAccountAssociation(idpName, "dummy_idp_account_1");
    userProfileMgtClient.addFedIdpAccountAssociation(idpName, "dummy_idp_account_2");
    AssociatedAccountDTO[] associatedFedUserAccountIds = userProfileMgtClient.getAssociatedFedUserAccountIds();
    Assert.assertNotNull(associatedFedUserAccountIds);
    Assert.assertEquals(associatedFedUserAccountIds.length, 2);
    // delete the user, this should clear the federated idp account associations
    userMgtClient.deleteUser(username);
    Assert.assertEquals(userMgtClient.getUserList().contains(username), false);
    // create the same user
    userMgtClient.addUser(username, password, new String[] { "admin" }, "default");
    userProfileMgtClient = new UserProfileMgtServiceClient(backendURL, username, password);
    associatedFedUserAccountIds = userProfileMgtClient.getAssociatedFedUserAccountIds();
    // assert to make sure there are no federated idp user account associations for this user
    Assert.assertEquals(associatedFedUserAccountIds == null || associatedFedUserAccountIds.length == 0, true);
}
Also used : UserProfileMgtServiceClient(org.wso2.identity.integration.common.clients.UserProfileMgtServiceClient) AssociatedAccountDTO(org.wso2.carbon.identity.user.profile.stub.types.AssociatedAccountDTO) UserManagementClient(org.wso2.identity.integration.common.clients.UserManagementClient) IdentityProvider(org.wso2.carbon.identity.application.common.model.idp.xsd.IdentityProvider) IdentityProviderMgtServiceClient(org.wso2.identity.integration.common.clients.Idp.IdentityProviderMgtServiceClient) ISIntegrationTest(org.wso2.identity.integration.common.utils.ISIntegrationTest) Test(org.testng.annotations.Test)

Example 23 with UserManagementClient

use of org.wso2.carbon.integration.common.admin.client.UserManagementClient in project product-is by wso2.

the class UserProfileAdminTestCase method testInit.

@BeforeClass(alwaysRun = true)
public void testInit() throws Exception {
    super.init();
    String carbonHome = Utils.getResidentCarbonHome();
    File defaultTomlFile = getDeploymentTomlFile(carbonHome);
    File configuredTomlFile = new File(getISResourceLocation() + File.separator + "user" + File.separator + "enable_federated_association.toml");
    serverConfigurationManager = new ServerConfigurationManager(isServer);
    serverConfigurationManager.applyConfigurationWithoutRestart(configuredTomlFile, defaultTomlFile, true);
    serverConfigurationManager.restartGracefully();
    super.init();
    logManger = new AuthenticatorClient(backendURL);
    userProfileMgtClient = new UserProfileMgtServiceClient(backendURL, sessionCookie);
    userMgtClient = new UserManagementClient(backendURL, sessionCookie);
    userMgtClient.addUser(userId1, "passWord1@", new String[] { "admin" }, "default");
}
Also used : UserProfileMgtServiceClient(org.wso2.identity.integration.common.clients.UserProfileMgtServiceClient) AuthenticatorClient(org.wso2.carbon.integration.common.admin.client.AuthenticatorClient) ServerConfigurationManager(org.wso2.carbon.integration.common.utils.mgt.ServerConfigurationManager) UserManagementClient(org.wso2.identity.integration.common.clients.UserManagementClient) File(java.io.File) BeforeClass(org.testng.annotations.BeforeClass)

Example 24 with UserManagementClient

use of org.wso2.carbon.integration.common.admin.client.UserManagementClient in project product-is by wso2.

the class UserProfileMgtTestCase method testInit.

@BeforeClass(alwaysRun = true)
public void testInit() throws Exception {
    super.init();
    userMgtClient = new UserManagementClient(backendURL, sessionCookie);
    userMgtClient.addUser(userId1, "passWord1@", new String[] { "admin" }, "default");
    userProfileMgtClient = new UserProfileMgtServiceClient(backendURL, sessionCookie);
}
Also used : UserProfileMgtServiceClient(org.wso2.identity.integration.common.clients.UserProfileMgtServiceClient) UserManagementClient(org.wso2.identity.integration.common.clients.UserManagementClient) BeforeClass(org.testng.annotations.BeforeClass)

Example 25 with UserManagementClient

use of org.wso2.carbon.integration.common.admin.client.UserManagementClient in project product-is by wso2.

the class JDBCUserStoreAddingTestCase method testUserRoleCacheWithSecondary.

@Test(groups = "wso2.is", dependsOnMethods = "testAddJDBCUserStore")
public void testUserRoleCacheWithSecondary() throws Exception {
    String loginRole = "login";
    String secondaryUsername = "WSO2TEST.COM/user4219";
    String secondaryUserPassword = "password2";
    String primaryUsername = "user4219";
    String primaryUserPassword = "password1";
    userMgtClient = new UserManagementClient(backendURL, getSessionCookie());
    authenticatorClient = new AuthenticatorClient(backendURL);
    userMgtClient.addRole(loginRole, null, new String[] { PERMISSION_LOGIN });
    userMgtClient.addUser(secondaryUsername, secondaryUserPassword, new String[] {}, null);
    userMgtClient.addUser(primaryUsername, primaryUserPassword, new String[] { loginRole }, null);
    authenticatorClient.unsuccessfulLogin(primaryUsername, primaryUserPassword, isServer.getInstance().getHosts().get("default"));
    Assert.assertFalse(authenticatorClient.unsuccessfulLogin(secondaryUsername, secondaryUserPassword, isServer.getInstance().getHosts().get("default")), "User from secondary user store logged in without login " + "permissions.");
    userMgtClient.deleteUser(primaryUsername);
    userMgtClient.deleteUser(secondaryUsername);
    userMgtClient.deleteRole(loginRole);
    authenticatorClient.logOut();
}
Also used : AuthenticatorClient(org.wso2.carbon.integration.common.admin.client.AuthenticatorClient) UserManagementClient(org.wso2.identity.integration.common.clients.UserManagementClient) ISIntegrationTest(org.wso2.identity.integration.common.utils.ISIntegrationTest) Test(org.testng.annotations.Test)

Aggregations

UserManagementClient (org.wso2.identity.integration.common.clients.UserManagementClient)47 BeforeClass (org.testng.annotations.BeforeClass)30 AuthenticatorClient (org.wso2.carbon.integration.common.admin.client.AuthenticatorClient)19 File (java.io.File)8 Test (org.testng.annotations.Test)8 ISIntegrationTest (org.wso2.identity.integration.common.utils.ISIntegrationTest)8 ServerConfigurationManager (org.wso2.carbon.integration.common.utils.mgt.ServerConfigurationManager)7 SetEnvironment (org.wso2.carbon.automation.engine.annotations.SetEnvironment)6 UserProfileMgtServiceClient (org.wso2.identity.integration.common.clients.UserProfileMgtServiceClient)6 RemoteUserStoreManagerServiceClient (org.wso2.identity.integration.common.clients.usermgt.remote.RemoteUserStoreManagerServiceClient)6 LoginLogoutClient (org.wso2.carbon.integration.common.utils.LoginLogoutClient)5 IdentityProviderMgtServiceClient (org.wso2.identity.integration.common.clients.Idp.IdentityProviderMgtServiceClient)5 ApplicationManagementServiceClient (org.wso2.identity.integration.common.clients.application.mgt.ApplicationManagementServiceClient)4 AfterClass (org.testng.annotations.AfterClass)3 AutomationContext (org.wso2.carbon.automation.engine.context.AutomationContext)3 UserManagementClient (org.wso2.carbon.integration.common.admin.client.UserManagementClient)3 UserInformationRecoveryServiceClient (org.wso2.identity.integration.common.clients.mgt.UserInformationRecoveryServiceClient)3 UserStoreConfigAdminServiceClient (org.wso2.identity.integration.common.clients.user.store.config.UserStoreConfigAdminServiceClient)3 UserManagementClient (org.wso2.identity.scenarios.commons.clients.UserManagementClient)3 XPathExpressionException (javax.xml.xpath.XPathExpressionException)2