use of org.wso2.identity.scenarios.commons.clients.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);
}
use of org.wso2.identity.scenarios.commons.clients.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);
}
use of org.wso2.identity.scenarios.commons.clients.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");
}
use of org.wso2.identity.scenarios.commons.clients.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);
}
use of org.wso2.identity.scenarios.commons.clients.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();
}
Aggregations