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);
}
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());
}
Aggregations