Search in sources :

Example 31 with UserManagementClient

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

the class ReadOnlyLDAPUserStoreManagerTestCase method configureServer.

@BeforeClass(alwaysRun = true)
public void configureServer() throws Exception {
    super.init();
    userMgtClient = new UserManagementClient(backendURL, getSessionCookie());
    authenticatorClient = new AuthenticatorClient(backendURL);
    Assert.assertTrue(userMgtClient.roleNameExists(newUserRole), "Role name doesn't exists");
    Assert.assertTrue(userMgtClient.userNameExists(newUserRole, newUserName), "User name doesn't exists");
    String sessionCookie = authenticatorClient.login(newUserName, newUserPassword, isServer.getInstance().getHosts().get("default"));
    Assert.assertTrue(sessionCookie.contains("JSESSIONID"), "Session Cookie not found. Login failed");
    authenticatorClient.logOut();
    super.init(TestUserMode.SUPER_TENANT_ADMIN);
}
Also used : AuthenticatorClient(org.wso2.carbon.integration.common.admin.client.AuthenticatorClient) UserManagementClient(org.wso2.identity.integration.common.clients.UserManagementClient) BeforeClass(org.testng.annotations.BeforeClass)

Example 32 with UserManagementClient

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

the class UserMgtServiceAbstractTestCase method testInit.

protected void testInit() throws Exception {
    super.init();
    userMgtClient = new UserManagementClient(backendURL, sessionCookie);
    loginManger = new AuthenticatorClient(backendURL);
    adminUsername = userInfo.getUserName();
    adminPassword = userInfo.getPassword();
}
Also used : AuthenticatorClient(org.wso2.carbon.integration.common.admin.client.AuthenticatorClient) UserManagementClient(org.wso2.identity.integration.common.clients.UserManagementClient)

Example 33 with UserManagementClient

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

the class UserMgtTestCase method testGetRolesOfCurrentUser.

@Test(groups = "wso2.is", description = "Check get roles of current user")
public void testGetRolesOfCurrentUser() throws Exception {
    if (nameExists(userMgtClient.getAllRolesNames("umRole5", 100), "umRole5")) {
        userMgtClient.deleteRole("umRole5");
    }
    userMgtClient.addRole("umRole5", new String[] { "user3" }, new String[] { "admin" }, false);
    UserManagementClient userMgtClient1 = new UserManagementClient(isServer.getContextUrls().getBackEndUrl(), "user3", "passWord1@");
    Assert.assertTrue(nameExists(userMgtClient1.getRolesOfCurrentUser(), "umRole5"), "Getting current user roles has failed.");
    userMgtClient.deleteRole("umRole5");
}
Also used : UserManagementClient(org.wso2.identity.integration.common.clients.UserManagementClient) ISIntegrationTest(org.wso2.identity.integration.common.utils.ISIntegrationTest) Test(org.testng.annotations.Test)

Example 34 with UserManagementClient

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

the class RemoteUserStoreManagerServiceTestCase method testAddRole.

@Test(priority = 1, groups = "wso2.is", description = "Test addRole and isExistingRole operations")
public void testAddRole() throws Exception {
    // add two test roles with empty users
    // remoteUserStoreManagerClient.addRole(role1, null, null);
    remoteUserStoreManagerClient.addRole(role2, null, null);
    // Add role1 with configure, login, manage, monitor, protected permissions
    UserManagementClient userMgtClient = new UserManagementClient(backendURL, sessionCookie);
    String[] permissions = { "/permission/admin/configure/", "/permission/admin/login", "/permission/admin/manage/", "/permission/admin/monitor", "/permission/protected" };
    userMgtClient.addRole(role1, null, permissions);
    // verify role addition
    Assert.assertTrue(remoteUserStoreManagerClient.isExistingRole(role1), "Adding new role failed : " + role1);
    Assert.assertTrue(remoteUserStoreManagerClient.isExistingRole(role2), "Adding new role failed : " + role2);
}
Also used : UserManagementClient(org.wso2.identity.integration.common.clients.UserManagementClient) ISIntegrationTest(org.wso2.identity.integration.common.utils.ISIntegrationTest) Test(org.testng.annotations.Test)

Example 35 with UserManagementClient

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

the class AbstractUUIDUMTestCase method init.

protected void init() throws Exception {
    super.init();
    userMgtClient = new UUIDUserStoreManagerServiceClient(backendURL, sessionCookie);
    oldUserMgtClient = new UserManagementClient(backendURL, sessionCookie);
    loginManger = new AuthenticatorClient(backendURL);
    adminUsername = userInfo.getUserName();
    adminPassword = userInfo.getPassword();
}
Also used : UUIDUserStoreManagerServiceClient(org.wso2.identity.integration.common.clients.usermgt.uuid.UUIDUserStoreManagerServiceClient) AuthenticatorClient(org.wso2.carbon.integration.common.admin.client.AuthenticatorClient) UserManagementClient(org.wso2.identity.integration.common.clients.UserManagementClient)

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