Search in sources :

Example 1 with UserInformationRecoveryServiceClient

use of org.wso2.identity.integration.common.clients.mgt.UserInformationRecoveryServiceClient in project product-is by wso2.

the class UserInformationRecoveryServiceTenantEmailUserTestCase method testInit.

@SetEnvironment(executionEnvironments = { ExecutionEnvironment.ALL })
@BeforeClass(alwaysRun = true)
public void testInit() throws Exception {
    super.init();
    String carbonHome = Utils.getResidentCarbonHome();
    identityMgtServerFile = new File(carbonHome + File.separator + "repository" + File.separator + "conf" + File.separator + "identity" + File.separator + "identity-mgt.properties");
    File identityMgtConfigFile = new File(getISResourceLocation() + File.separator + "identityMgt" + File.separator + "identity-mgt-enabled.properties");
    File defaultTomlFile = getDeploymentTomlFile(carbonHome);
    File configuredTomlFile = new File(getISResourceLocation() + File.separator + "identityMgt" + File.separator + "user_mgt_regex_changed.toml");
    scm = new ServerConfigurationManager(isServer);
    scm.applyConfigurationWithoutRestart(identityMgtConfigFile, identityMgtServerFile, true);
    scm.applyConfigurationWithoutRestart(configuredTomlFile, defaultTomlFile, true);
    scm.restartGracefully();
    super.init();
    tenantServiceClient = new TenantManagementServiceClient(isServer.getContextUrls().getBackEndUrl(), sessionCookie);
    tenantServiceClient.addTenant(TENANT_DOMAIN, TENANT_ADMIN_TENANT_AWARE_USERNAME, TENANT_ADMIN_PASSWORD, TENANT_ADMIN_USERNAME, "Info", "Recovery");
    loginManger = new AuthenticatorClient(backendURL);
    sessionCookie = this.loginManger.login(TENANT_ADMIN_USERNAME, TENANT_ADMIN_PASSWORD, isServer.getInstance().getHosts().get(profileName));
    userMgtClient = new UserManagementClient(backendURL, sessionCookie);
    infoRecoveryClient = new UserInformationRecoveryServiceClient(backendURL, sessionCookie);
    userMgtClient.addUser(TENANT_USER, "passWord1@", null, profileName);
}
Also used : 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) TenantManagementServiceClient(org.wso2.identity.integration.common.clients.TenantManagementServiceClient) UserInformationRecoveryServiceClient(org.wso2.identity.integration.common.clients.mgt.UserInformationRecoveryServiceClient) BeforeClass(org.testng.annotations.BeforeClass) SetEnvironment(org.wso2.carbon.automation.engine.annotations.SetEnvironment)

Example 2 with UserInformationRecoveryServiceClient

use of org.wso2.identity.integration.common.clients.mgt.UserInformationRecoveryServiceClient in project product-is by wso2.

the class UserInformationRecoveryServiceTestCase method testInit.

@SetEnvironment(executionEnvironments = { ExecutionEnvironment.ALL })
@BeforeClass(alwaysRun = true)
public void testInit() throws Exception {
    super.init();
    String carbonHome = Utils.getResidentCarbonHome();
    identityMgtServerFile = new File(carbonHome + File.separator + "repository" + File.separator + "conf" + File.separator + "identity" + File.separator + "identity-mgt.properties");
    File identityMgtConfigFile = new File(getISResourceLocation() + File.separator + "identityMgt" + File.separator + "identity-mgt-enabled.properties");
    axisServerFile = new File(carbonHome + File.separator + "repository" + File.separator + "conf" + File.separator + "axis2" + File.separator + "axis2.xml");
    File axisConfigFile = new File(getISResourceLocation() + File.separator + "identityMgt" + File.separator + "axis2.xml");
    scm = new ServerConfigurationManager(isServer);
    scm.applyConfigurationWithoutRestart(identityMgtConfigFile, identityMgtServerFile, true);
    scm.applyConfigurationWithoutRestart(axisConfigFile, axisServerFile, true);
    scm.restartGracefully();
    super.init();
    loginManger = new AuthenticatorClient(backendURL);
    userMgtClient = new UserManagementClient(backendURL, sessionCookie);
    infoRecoveryClient = new UserInformationRecoveryServiceClient(backendURL, sessionCookie);
    profileClient = new UserProfileMgtServiceClient(backendURL, sessionCookie);
    loginManger.login(isServer.getSuperTenant().getTenantAdmin().getUserName(), isServer.getSuperTenant().getTenantAdmin().getPassword(), isServer.getInstance().getHosts().get("default"));
    claimMgtClient = new ClaimManagementServiceClient(backendURL, sessionCookie);
    ClaimDTO claim1 = new ClaimDTO();
    claim1.setDialectURI("http://wso2.org/claims");
    claim1.setClaimUri("http://wso2.org/claims/identity/unlockTime");
    claim1.setDescription("Account Unlock time");
    ClaimDTO claim2 = new ClaimDTO();
    claim2.setDialectURI("http://wso2.org/claims");
    claim2.setClaimUri("http://wso2.org/claims/identity/failedLoginAttempts");
    claim2.setDescription("Failed login attempts");
    ClaimMappingDTO claimMapping1 = new ClaimMappingDTO();
    claimMapping1.setClaim(claim1);
    claimMapping1.setMappedAttribute("description");
    claimMgtClient.addNewClaimMapping(claimMapping1);
    ClaimMappingDTO claimMapping2 = new ClaimMappingDTO();
    claimMapping2.setClaim(claim2);
    claimMapping2.setMappedAttribute("employeeType");
    claimMgtClient.addNewClaimMapping(claimMapping2);
    userMgtClient.addUser("user11", "passWord1@", null, "default");
    userMgtClient.addRole("umRole11", new String[] { "user11" }, new String[] { "/permission/admin/login" }, false);
}
Also used : UserProfileMgtServiceClient(org.wso2.identity.integration.common.clients.UserProfileMgtServiceClient) ClaimMappingDTO(org.wso2.carbon.claim.mgt.stub.dto.ClaimMappingDTO) UserIdentityClaimDTO(org.wso2.carbon.identity.mgt.stub.dto.UserIdentityClaimDTO) ClaimDTO(org.wso2.carbon.claim.mgt.stub.dto.ClaimDTO) ClaimManagementServiceClient(org.wso2.identity.integration.common.clients.ClaimManagementServiceClient) 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) UserInformationRecoveryServiceClient(org.wso2.identity.integration.common.clients.mgt.UserInformationRecoveryServiceClient) BeforeClass(org.testng.annotations.BeforeClass) SetEnvironment(org.wso2.carbon.automation.engine.annotations.SetEnvironment)

Example 3 with UserInformationRecoveryServiceClient

use of org.wso2.identity.integration.common.clients.mgt.UserInformationRecoveryServiceClient in project product-is by wso2.

the class AccountLockingWhileSCIMEnabledTestCase method testInit.

@SetEnvironment(executionEnvironments = { ExecutionEnvironment.ALL })
@BeforeClass(alwaysRun = true)
public void testInit() throws Exception {
    super.init();
    String carbonHome = Utils.getResidentCarbonHome();
    identityMgtServerFile = new File(carbonHome + File.separator + "repository" + File.separator + "conf" + File.separator + "identity" + File.separator + "identity-mgt.properties");
    File identityMgtConfigFile = new File(getISResourceLocation() + File.separator + "identityMgt" + File.separator + "identity-mgt-account-lock-enabled.properties");
    userMgtServerFile = new File(carbonHome + File.separator + "repository" + File.separator + "conf" + File.separator + "user-mgt.xml");
    File scimEnabledUserMgtCofigFile = new File(getISResourceLocation() + File.separator + "userMgt" + File.separator + "scim-enabled-user-mgt.xml");
    scm = new ServerConfigurationManager(isServer);
    scm.applyConfigurationWithoutRestart(identityMgtConfigFile, identityMgtServerFile, true);
    scm.applyConfigurationWithoutRestart(scimEnabledUserMgtCofigFile, userMgtServerFile, true);
    scm.restartGracefully();
    super.init();
    loginManger = new AuthenticatorClient(backendURL);
    userMgtClient = new UserManagementClient(backendURL, sessionCookie);
    infoRecoveryClient = new UserInformationRecoveryServiceClient(backendURL, sessionCookie);
    profileClient = new UserProfileMgtServiceClient(backendURL, sessionCookie);
    loginManger.login(isServer.getSuperTenant().getTenantAdmin().getUserName(), isServer.getSuperTenant().getTenantAdmin().getPassword(), isServer.getInstance().getHosts().get("default"));
    claimMgtClient = new ClaimManagementServiceClient(backendURL, sessionCookie);
    ClaimValue[] claimValues = new ClaimValue[1];
    // Need to add this claim and have the value true in order to test the fix
    ClaimValue scimActiveClaim = new ClaimValue();
    scimActiveClaim.setClaimURI(SCIM_ACTIVE_URI);
    scimActiveClaim.setValue("true");
    claimValues[0] = scimActiveClaim;
    remoteUSMServiceClient = new RemoteUserStoreManagerServiceClient(backendURL, sessionCookie);
    remoteUSMServiceClient.addUser(TEST_USER_USERNAME, TEST_USER_PASSWORD, null, claimValues, PROFILE_NAME, false);
    userMgtClient.addRole(TEST_ROLE, new String[] { TEST_USER_USERNAME }, new String[] { "/permission/admin/login" }, false);
}
Also used : UserProfileMgtServiceClient(org.wso2.identity.integration.common.clients.UserProfileMgtServiceClient) ClaimManagementServiceClient(org.wso2.identity.integration.common.clients.ClaimManagementServiceClient) ClaimValue(org.wso2.carbon.um.ws.api.stub.ClaimValue) 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) RemoteUserStoreManagerServiceClient(org.wso2.identity.integration.common.clients.usermgt.remote.RemoteUserStoreManagerServiceClient) File(java.io.File) UserInformationRecoveryServiceClient(org.wso2.identity.integration.common.clients.mgt.UserInformationRecoveryServiceClient) BeforeClass(org.testng.annotations.BeforeClass) SetEnvironment(org.wso2.carbon.automation.engine.annotations.SetEnvironment)

Aggregations

File (java.io.File)3 BeforeClass (org.testng.annotations.BeforeClass)3 SetEnvironment (org.wso2.carbon.automation.engine.annotations.SetEnvironment)3 AuthenticatorClient (org.wso2.carbon.integration.common.admin.client.AuthenticatorClient)3 ServerConfigurationManager (org.wso2.carbon.integration.common.utils.mgt.ServerConfigurationManager)3 UserManagementClient (org.wso2.identity.integration.common.clients.UserManagementClient)3 UserInformationRecoveryServiceClient (org.wso2.identity.integration.common.clients.mgt.UserInformationRecoveryServiceClient)3 ClaimManagementServiceClient (org.wso2.identity.integration.common.clients.ClaimManagementServiceClient)2 UserProfileMgtServiceClient (org.wso2.identity.integration.common.clients.UserProfileMgtServiceClient)2 ClaimDTO (org.wso2.carbon.claim.mgt.stub.dto.ClaimDTO)1 ClaimMappingDTO (org.wso2.carbon.claim.mgt.stub.dto.ClaimMappingDTO)1 UserIdentityClaimDTO (org.wso2.carbon.identity.mgt.stub.dto.UserIdentityClaimDTO)1 ClaimValue (org.wso2.carbon.um.ws.api.stub.ClaimValue)1 TenantManagementServiceClient (org.wso2.identity.integration.common.clients.TenantManagementServiceClient)1 RemoteUserStoreManagerServiceClient (org.wso2.identity.integration.common.clients.usermgt.remote.RemoteUserStoreManagerServiceClient)1