Search in sources :

Example 51 with UserManagementClient

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

the class OIDCIdentityFederationTestCase 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 52 with UserManagementClient

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

the class JustInTimeProvisioningTestCase method initTest.

@BeforeClass(alwaysRun = true)
public void initTest() throws Exception {
    try {
        super.initTest();
        backendURL = context.getContextUrls().getBackEndUrl();
        logManger = new AuthenticatorClient(backendURL);
        sessionCookie = logManger.login(username, userPassword, context.getInstance().getHosts().get("default"));
        userMgtClient = new UserManagementClient(backendURL, sessionCookie);
        userStoreClient = new RemoteUserStoreManagerServiceClient(backendURL, sessionCookie);
        userStoreConfigAdminServiceClient = new UserStoreConfigAdminServiceClient(backendURL, sessionCookie);
        RemoteAuthorizationManagerServiceClient remoteAuthorizationManagerServiceClient = new RemoteAuthorizationManagerServiceClient(backendURL, sessionCookie);
        log.info("login user name : " + username);
        log.info("login password : " + userPassword);
        for (String role : userStoreClient.getRoleListOfUser(username)) {
            boolean roleAuthorized = remoteAuthorizationManagerServiceClient.isRoleAuthorized(role, "/permission/admin/manage/identity/rolemgt/create", "ui.execute");
            log.info("Role Authorization :" + roleAuthorized + " role: " + role);
        }
        boolean isUserAuthorized = remoteAuthorizationManagerServiceClient.isUserAuthorized(username, "/permission" + "/admin/manage/identity/rolemgt/create", "ui.execute");
        log.info("User Authorization :" + isUserAuthorized);
        remoteAuthorizationManagerServiceClient.authorizeUser(username, "/permission/admin/", "ui.execute");
        boolean isAuthorized = remoteAuthorizationManagerServiceClient.isUserAuthorized(username, "/permission" + "/admin/manage/identity/rolemgt/create", "ui.execute");
        log.info("User Authorization details :" + isAuthorized);
        userMgtClient.addInternalRole("loginJIT", null, new String[] { "/permission/admin/login" });
        addSecondaryUserStore();
    } catch (Exception e) {
        log.error("Failure occured due to :" + e.getMessage(), e);
        throw e;
    }
}
Also used : RemoteAuthorizationManagerServiceClient(org.wso2.identity.integration.common.clients.authorization.mgt.RemoteAuthorizationManagerServiceClient) AuthenticatorClient(org.wso2.carbon.integration.common.admin.client.AuthenticatorClient) UserManagementClient(org.wso2.identity.integration.common.clients.UserManagementClient) RemoteUserStoreManagerServiceClient(org.wso2.identity.integration.common.clients.usermgt.remote.RemoteUserStoreManagerServiceClient) UserStoreConfigAdminServiceClient(org.wso2.identity.integration.common.clients.user.store.config.UserStoreConfigAdminServiceClient) XPathExpressionException(javax.xml.xpath.XPathExpressionException) RemoteException(java.rmi.RemoteException) AutomationFrameworkException(org.wso2.carbon.automation.engine.exceptions.AutomationFrameworkException) RemoteUserStoreManagerServiceUserStoreExceptionException(org.wso2.carbon.um.ws.api.stub.RemoteUserStoreManagerServiceUserStoreExceptionException) LoginAuthenticationExceptionException(org.wso2.carbon.authenticator.stub.LoginAuthenticationExceptionException) BeforeClass(org.testng.annotations.BeforeClass)

Example 53 with UserManagementClient

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

the class IdentityProviderManagementTestCase method testInit.

@BeforeClass(alwaysRun = true)
public void testInit() throws Exception {
    super.init();
    ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(null, null);
    identityProviderMgtServiceClient = new IdentityProviderMgtServiceClient(sessionCookie, backendURL, configContext);
    userMgtClient = new UserManagementClient(backendURL, getSessionCookie());
    userMgtClient.addRole("umRole1", null, new String[] { "login" }, false);
}
Also used : ConfigurationContext(org.apache.axis2.context.ConfigurationContext) UserManagementClient(org.wso2.identity.integration.common.clients.UserManagementClient) IdentityProviderMgtServiceClient(org.wso2.identity.integration.common.clients.Idp.IdentityProviderMgtServiceClient) BeforeClass(org.testng.annotations.BeforeClass)

Example 54 with UserManagementClient

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

the class OAuthAdminServiceTestCase method testInit.

@BeforeClass(alwaysRun = true)
public void testInit() throws Exception {
    super.init();
    logManger = new AuthenticatorClient(backendURL);
    userMgtClient = new UserManagementClient(backendURL, sessionCookie);
    // create a user with capital letters in user name
    userMgtClient.addUser(userName, password, null, "default");
    String[] userList = new String[] { userName };
    FlaggedName[] userFlagList = new FlaggedName[userList.length];
    for (int i = 0; i < userFlagList.length; i++) {
        FlaggedName flaggedName = new FlaggedName();
        flaggedName.setItemName(userList[i]);
        flaggedName.setSelected(true);
        userFlagList[i] = flaggedName;
    }
    userMgtClient.updateUsersOfRole("admin", userFlagList);
    String cookie = this.logManger.login(userName, password, isServer.getInstance().getHosts().get("default"));
    adminClient = new OauthAdminClient(backendURL, cookie);
}
Also used : OauthAdminClient(org.wso2.identity.integration.common.clients.oauth.OauthAdminClient) AuthenticatorClient(org.wso2.carbon.integration.common.admin.client.AuthenticatorClient) FlaggedName(org.wso2.carbon.user.mgt.stub.types.carbon.FlaggedName) UserManagementClient(org.wso2.identity.integration.common.clients.UserManagementClient) BeforeClass(org.testng.annotations.BeforeClass)

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