Search in sources :

Example 46 with UserManagementClient

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

the class EntitlementNotificationTestCase method testInit.

@BeforeClass(alwaysRun = true)
public void testInit() throws Exception {
    super.init();
    changeISConfiguration();
    super.init();
    entitlementPolicyClient = new EntitlementPolicyServiceClient(backendURL, sessionCookie);
    userMgtServiceClient = new UserManagementClient(backendURL, sessionCookie);
}
Also used : UserManagementClient(org.wso2.identity.integration.common.clients.UserManagementClient) EntitlementPolicyServiceClient(org.wso2.identity.integration.common.clients.entitlement.EntitlementPolicyServiceClient) BeforeClass(org.testng.annotations.BeforeClass)

Example 47 with UserManagementClient

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

the class ApplicationManagementTestCase method testRetrieveFederatedIdPsWithLoginPermission.

@Test(alwaysRun = true, description = "Retrieve all federated IdPs with login permission")
public void testRetrieveFederatedIdPsWithLoginPermission() {
    try {
        String loginRole = "loginRole";
        String testAssociationUser1 = "testAssociationUser1";
        String testPassword1 = "testPassword1";
        UserManagementClient userMgtClient = new UserManagementClient(backendURL, sessionCookie);
        userMgtClient.addRole(loginRole, new String[0], new String[] { PERMISSION_ADMIN_LOGIN });
        userMgtClient.addUser(testAssociationUser1, testPassword1, new String[] { loginRole }, null);
        ApplicationManagementServiceClient appManageServiceClient = new ApplicationManagementServiceClient(testAssociationUser1, testPassword1, backendURL, configContext);
        IdentityProvider[] idps = appManageServiceClient.getAllFederatedIdentityProvider();
        Assert.assertTrue(idps != null && idps.length != 0, "Federated IdPs have been retrieved by a" + " user with login permission.");
    } catch (Exception e) {
        Assert.fail("Error while trying to retrieve federated idps with login permission", e);
    }
}
Also used : ApplicationManagementServiceClient(org.wso2.identity.integration.common.clients.application.mgt.ApplicationManagementServiceClient) UserManagementClient(org.wso2.identity.integration.common.clients.UserManagementClient) ISIntegrationTest(org.wso2.identity.integration.common.utils.ISIntegrationTest)

Example 48 with UserManagementClient

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

the class OIDCFederatedIdpInitLogoutTest method addUserToSecondaryIS.

private boolean addUserToSecondaryIS() throws Exception {
    UserManagementClient usrMgtClient = new UserManagementClient(getSecondaryISURI(), "admin", "admin");
    if (usrMgtClient == null) {
        return false;
    } else {
        String[] roles = { SECONDARY_IS_TEST_USER_ROLES };
        usrMgtClient.addUser(SECONDARY_IS_TEST_USERNAME, SECONDARY_IS_TEST_PASSWORD, roles, null);
        if (usrMgtClient.userNameExists(SECONDARY_IS_TEST_USER_ROLES, SECONDARY_IS_TEST_USERNAME)) {
            return true;
        } else {
            return false;
        }
    }
}
Also used : UserManagementClient(org.wso2.identity.integration.common.clients.UserManagementClient)

Example 49 with UserManagementClient

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

the class OIDCFederatedIdpInitLogoutTest method deleteAddedUsersInSecondaryIS.

private void deleteAddedUsersInSecondaryIS() throws RemoteException, UserAdminUserAdminException {
    UserManagementClient usrMgtClient = new UserManagementClient(getSecondaryISURI(), "admin", "admin");
    usrMgtClient.deleteUser(SECONDARY_IS_TEST_USERNAME);
}
Also used : UserManagementClient(org.wso2.identity.integration.common.clients.UserManagementClient)

Example 50 with UserManagementClient

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

the class OIDCIdentityFederationTestCase method addUserToSecondaryIS.

/**
 *TODO Test case for consent denial from the federated IdP during the logout. Implement after resolving
 * {@link https://github.com/wso2/product-is/issues/10636}
 */
// @Test(groups = "wso2.is", description = "Check SAML-to-OIDC federated logout deny-consent", dependsOnMethods = {
// "testFederatedLogin"})
// public void testLogoutDenyConsent() throws Exception {
// 
// sendLogoutRequestToPrimaryIS();
// 
// String consentDeniedResponseToWebapp = doLogoutConsentDenyInSecondaryIS();
// Assert.assertNotNull(consentDeniedResponseToWebapp,
// "Unable to acquire logout consent deny response");
// Assert.assertTrue(consentDeniedResponseToWebapp.contains("access_denied"));
// }
private boolean addUserToSecondaryIS() throws Exception {
    UserManagementClient usrMgtClient = new UserManagementClient(getSecondaryISURI(), "admin", "admin");
    if (usrMgtClient == null) {
        return false;
    } else {
        String[] roles = { SECONDARY_IS_TEST_USER_ROLES };
        usrMgtClient.addUser(SECONDARY_IS_TEST_USERNAME, SECONDARY_IS_TEST_PASSWORD, roles, null);
        if (usrMgtClient.userNameExists(SECONDARY_IS_TEST_USER_ROLES, SECONDARY_IS_TEST_USERNAME)) {
            return true;
        } else {
            return false;
        }
    }
}
Also used : 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