Search in sources :

Example 26 with PasswordType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.PasswordType in project midpoint by Evolveum.

the class TestImportRecon method test330ReconcileDummyAzureAddAccountRapp.

/**
	 * Create account that will correlate to existing user.
	 * See that it is linked and modified.
	 */
@Test
public void test330ReconcileDummyAzureAddAccountRapp() throws Exception {
    final String TEST_NAME = "test330ReconcileDummyAzureAddAccountRapp";
    TestUtil.displayTestTile(this, TEST_NAME);
    // GIVEN
    Task task = createTask(TestImportRecon.class.getName() + "." + TEST_NAME);
    OperationResult result = task.getResult();
    assumeAssignmentPolicy(AssignmentPolicyEnforcementType.NONE);
    getDummyResource().setBreakMode(BreakMode.NONE);
    dummyResourceAzure.setBreakMode(BreakMode.NONE);
    dummyResourceCtlAzure.addAccount(USER_RAPP_USERNAME, USER_RAPP_FULLNAME);
    display("Rapp azure account before", dummyResourceAzure.getAccountByUsername(USER_RAPP_USERNAME));
    PrismObject<UserType> userRappBefore = getUser(USER_RAPP_OID);
    display("User rapp before", userRappBefore);
    PrismAsserts.assertPropertyValue(userRappBefore, UserType.F_ORGANIZATIONAL_UNIT, PrismTestUtil.createPolyString("The crew of The Elaine"));
    dummyResourceAzure.purgeScriptHistory();
    dummyAuditService.clear();
    reconciliationTaskResultListener.clear();
    // WHEN
    TestUtil.displayWhen(TEST_NAME);
    restartTask(TASK_RECONCILE_DUMMY_AZURE_OID);
    // THEN
    TestUtil.displayThen(TEST_NAME);
    waitForTaskFinish(TASK_RECONCILE_DUMMY_AZURE_OID, false);
    TestUtil.displayThen(TEST_NAME);
    List<PrismObject<UserType>> users = modelService.searchObjects(UserType.class, null, null, task, result);
    display("Users after reconcile", users);
    reconciliationTaskResultListener.assertResult(RESOURCE_DUMMY_AZURE_OID, 0, 1, 0, 0);
    assertImportedUserByOid(USER_ADMINISTRATOR_OID);
    assertImportedUserByOid(USER_JACK_OID);
    assertImportedUserByOid(USER_BARBOSSA_OID);
    assertImportedUserByUsername(ACCOUNT_HERMAN_DUMMY_USERNAME);
    assertImportedUserByUsername(ACCOUNT_HTM_NAME, RESOURCE_DUMMY_OID);
    // Rapp
    display("Rapp azure account after", dummyResourceAzure.getAccountByUsername(USER_RAPP_USERNAME));
    assertImportedUserByOid(USER_RAPP_OID, RESOURCE_DUMMY_OID, RESOURCE_DUMMY_LIME_OID, RESOURCE_DUMMY_AZURE_OID);
    assertDummyAccount(RESOURCE_DUMMY_AZURE_NAME, USER_RAPP_USERNAME, USER_RAPP_FULLNAME, true);
    assertDummyAccountAttribute(RESOURCE_DUMMY_AZURE_NAME, USER_RAPP_USERNAME, DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_SHIP_NAME, "The crew of The Elaine");
    //Checking password policy
    PrismObject<UserType> userRapp = findUserByUsername(USER_RAPP_USERNAME);
    assertNotNull("No user Rapp", userRapp);
    UserType userTypeRapp = userRapp.asObjectable();
    assertNotNull("User Rapp has no credentials", userTypeRapp.getCredentials());
    PasswordType password = userTypeRapp.getCredentials().getPassword();
    assertNotNull("User Rapp has no password", password);
    ProtectedStringType passwordType = password.getValue();
    String stringPassword = null;
    if (passwordType.getClearValue() == null) {
        stringPassword = protector.decryptString(passwordType);
    }
    assertNotNull("No clear text password", stringPassword);
    PrismObject<ValuePolicyType> passwordPolicy = getObjectViaRepo(ValuePolicyType.class, PASSWORD_POLICY_LOWER_CASE_ALPHA_AZURE_OID);
    boolean isPasswordValid = valuePolicyProcessor.validateValue(stringPassword, passwordPolicy.asObjectable(), userRapp, TEST_NAME, task, result);
    assertTrue("Password doesn't satisfy password policy, generated password: " + stringPassword, isPasswordValid);
    // These are protected accounts, they should not be imported
    assertNoImporterUserByUsername(ACCOUNT_DAVIEJONES_DUMMY_USERNAME);
    assertNoImporterUserByUsername(ACCOUNT_CALYPSO_DUMMY_USERNAME);
    // Calypso is protected account. Reconciliation should not touch it
    assertDummyAccountAttribute(null, ACCOUNT_CALYPSO_DUMMY_USERNAME, DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_FULLNAME_NAME, "Calypso");
    assertEquals("Unexpected number of users", 11, users.size());
    display("Dummy resource (azure)", dummyResourceAzure.debugDump());
    assertReconAuditModifications(1, TASK_RECONCILE_DUMMY_AZURE_OID);
}
Also used : Task(com.evolveum.midpoint.task.api.Task) ValuePolicyType(com.evolveum.midpoint.xml.ns._public.common.common_3.ValuePolicyType) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) PasswordType(com.evolveum.midpoint.xml.ns._public.common.common_3.PasswordType) PrismObject(com.evolveum.midpoint.prism.PrismObject) UserType(com.evolveum.midpoint.xml.ns._public.common.common_3.UserType) ProtectedStringType(com.evolveum.prism.xml.ns._public.types_3.ProtectedStringType) Test(org.testng.annotations.Test) AbstractInitializedModelIntegrationTest(com.evolveum.midpoint.model.intest.AbstractInitializedModelIntegrationTest)

Example 27 with PasswordType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.PasswordType in project midpoint by Evolveum.

the class TestDummyIncomplete method checkAccountWill.

@Override
protected void checkAccountWill(PrismObject<ShadowType> shadow, OperationResult result, XMLGregorianCalendar startTs, XMLGregorianCalendar endTs) throws SchemaException, EncryptionException {
    super.checkAccountWill(shadow, result, startTs, endTs);
    CredentialsType credentials = shadow.asObjectable().getCredentials();
    assertNotNull("No credentials in " + shadow, credentials);
    PasswordType password = credentials.getPassword();
    assertNotNull("No password in " + shadow, password);
    PrismContainerValue<PasswordType> passwordContainerValue = password.asPrismContainerValue();
    PrismProperty<ProtectedStringType> valueProperty = passwordContainerValue.findProperty(PasswordType.F_VALUE);
    assertTrue("Unexpected password value in " + shadow + ": " + valueProperty, valueProperty.getValues().isEmpty());
    assertTrue("No incompleteness in password value in " + shadow + ": " + valueProperty, valueProperty.isIncomplete());
}
Also used : CredentialsType(com.evolveum.midpoint.xml.ns._public.common.common_3.CredentialsType) PasswordType(com.evolveum.midpoint.xml.ns._public.common.common_3.PasswordType) ProtectedStringType(com.evolveum.prism.xml.ns._public.types_3.ProtectedStringType)

Aggregations

PasswordType (com.evolveum.midpoint.xml.ns._public.common.common_3.PasswordType)23 ProtectedStringType (com.evolveum.prism.xml.ns._public.types_3.ProtectedStringType)18 CredentialsType (com.evolveum.midpoint.xml.ns._public.common.common_3.CredentialsType)16 UserType (com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)9 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)8 Test (org.testng.annotations.Test)8 Task (com.evolveum.midpoint.task.api.Task)7 AbstractInitializedModelIntegrationTest (com.evolveum.midpoint.model.intest.AbstractInitializedModelIntegrationTest)2 PrismObject (com.evolveum.midpoint.prism.PrismObject)2 ObjectDelta (com.evolveum.midpoint.prism.delta.ObjectDelta)2 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)2 CommunicationException (com.evolveum.midpoint.util.exception.CommunicationException)2 ConfigurationException (com.evolveum.midpoint.util.exception.ConfigurationException)2 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)2 SystemException (com.evolveum.midpoint.util.exception.SystemException)2 MetadataType (com.evolveum.midpoint.xml.ns._public.common.common_3.MetadataType)2 ObjectType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType)2 PasswordHistoryEntryType (com.evolveum.midpoint.xml.ns._public.common.common_3.PasswordHistoryEntryType)2 ShadowType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)2 RefinedObjectClassDefinition (com.evolveum.midpoint.common.refinery.RefinedObjectClassDefinition)1