use of com.evolveum.midpoint.xml.ns._public.common.common_3.CredentialsType in project midpoint by Evolveum.
the class TestEditSchema method test213ModifiedUserJack.
/**
* Modify jack, see if the schema still applies.
*/
@Test
public void test213ModifiedUserJack() throws Exception {
final String TEST_NAME = "test213ModifiedUserJack";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
Task task = taskManager.createTaskInstance(TestEditSchema.class.getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
modifyObjectReplaceProperty(UserType.class, USER_JACK_OID, UserType.F_PREFERRED_LANGUAGE, task, result, "en_PR");
// WHEN
TestUtil.displayWhen(TEST_NAME);
PrismObject<UserType> user = modelService.getObject(UserType.class, USER_JACK_OID, null, task, result);
// THEN
TestUtil.displayThen(TEST_NAME);
result.computeStatus();
TestUtil.assertSuccess(result);
assertPropertyValues(user, UserType.F_ADDITIONAL_NAME, new Validator<PrismPropertyDefinition<PolyString>>() {
@Override
public void validate(PrismPropertyDefinition<PolyString> propDef, String name) throws Exception {
assertNotNull("No definition for additionalName in user", propDef);
assertEquals("Wrong additionalName displayName", "Middle Name", propDef.getDisplayName());
assertTrue("additionalName not readable", propDef.canRead());
}
}, PrismTestUtil.createPolyString("Jackie"));
assertPropertyValues(user, UserType.F_COST_CENTER, new Validator<PrismPropertyDefinition<String>>() {
@Override
public void validate(PrismPropertyDefinition<String> propDef, String name) throws Exception {
assertNotNull("No definition for costCenter in user", propDef);
assertEquals("Wrong costCenter displayOrder", (Integer) 123, propDef.getDisplayOrder());
assertTrue("costCenter not readable", propDef.canRead());
}
}, // This is set by user template
"G001");
assertPropertyValues(user, UserType.F_PREFERRED_LANGUAGE, new Validator<PrismPropertyDefinition<String>>() {
@Override
public void validate(PrismPropertyDefinition<String> propDef, String name) throws Exception {
assertNotNull("No definition for preferredLanguage in user", propDef);
assertEquals("Wrong preferredLanguage displayName", "Language", propDef.getDisplayName());
assertTrue("preferredLanguage not readable", propDef.canRead());
PrismReferenceValue valueEnumerationRef = propDef.getValueEnumerationRef();
assertNotNull("No valueEnumerationRef for preferredLanguage", valueEnumerationRef);
assertEquals("Wrong valueEnumerationRef OID for preferredLanguage", LOOKUP_LANGUAGES_OID, valueEnumerationRef.getOid());
}
}, "en_PR");
assertContainer(user, UserType.F_CREDENTIALS, new Validator<PrismContainerDefinition<CredentialsType>>() {
@Override
public void validate(PrismContainerDefinition<CredentialsType> credentialsDef, String name) throws Exception {
assertNotNull("No definition for credentials in user", credentialsDef);
assertTrue("Credentials not readable", credentialsDef.canRead());
}
}, true);
assertProperty(user, new ItemPath(UserType.F_CREDENTIALS, CredentialsType.F_PASSWORD, PasswordType.F_VALUE), new Validator<PrismPropertyDefinition<String>>() {
@Override
public void validate(PrismPropertyDefinition<String> propDef, String name) throws Exception {
assertTrue("Password not readable", propDef.canRead());
}
});
assertUntouchedUserDefinition();
assertSteadyResources();
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.CredentialsType in project midpoint by Evolveum.
the class TestPasswordPolicyProcessor method test203modifyUserJackPasswordNoPasswordHistory.
@Test
public void test203modifyUserJackPasswordNoPasswordHistory() throws Exception {
final String TEST_NAME = "test203modifyUserJackPasswordNoPasswordHistory";
TestUtil.displayTestTile(TEST_NAME);
Task task = taskManager.createTaskInstance(TEST_NAME);
OperationResult result = task.getResult();
// WHEN
ProtectedStringType newValue = new ProtectedStringType();
newValue.setClearValue("n0Hist0ryEntr7");
modifyObjectReplaceProperty(UserType.class, USER_JACK_OID, new ItemPath(UserType.F_CREDENTIALS, CredentialsType.F_PASSWORD, PasswordType.F_VALUE), task, result, newValue);
// THEN
PrismObject<UserType> userJack = getObject(UserType.class, USER_JACK_OID);
assertNotNull("Expected to find user Jack, but no one exists here", userJack);
UserType userJackType = userJack.asObjectable();
CredentialsType credentials = userJackType.getCredentials();
assertNotNull("User Jack has no credentials", credentials);
PasswordType password = credentials.getPassword();
assertNotNull("User Jack has no password", password);
List<PasswordHistoryEntryType> historyEntries = password.getHistoryEntry();
assertEquals("Expected no history entries, but found: " + historyEntries.size(), 0, historyEntries.size());
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.CredentialsType in project midpoint by Evolveum.
the class TestPasswordPolicyProcessor method test101ModifyUserPassword.
@Test
public void test101ModifyUserPassword() throws Exception {
final String TEST_NAME = "test101ModifyUserPassword";
TestUtil.displayTestTile(TEST_NAME);
Task task = createTask(TEST_NAME);
OperationResult result = task.getResult();
// WHEN
modifyUserChangePassword(USER_JACK_OID, PASSWORD1, task, result);
// THEN
PrismObject<UserType> jack = getObject(UserType.class, USER_JACK_OID);
assertNotNull("User Jack was not found.", jack);
UserType jackType = jack.asObjectable();
CredentialsType credentialsType = jackType.getCredentials();
assertNotNull("No credentials set for user Jack", credentialsType);
PasswordType passwordType = credentialsType.getPassword();
assertNotNull("No password set for user Jack", passwordType);
ProtectedStringType passwordAfterChange = passwordType.getValue();
assertNotNull("Password musn't be null", passwordAfterChange);
assertEquals("Password doesn't match", PASSWORD1, protector.decryptString(passwordAfterChange));
assertPasswordHistoryEntries(passwordType, USER_JACK_PASSWORD);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.CredentialsType in project midpoint by Evolveum.
the class AbstractModelIntegrationTest method assertShadowLdapPassword.
protected void assertShadowLdapPassword(PrismObject<ShadowType> shadow, String expectedPassword) throws EncryptionException {
CredentialsType credentialsType = shadow.asObjectable().getCredentials();
assertNotNull("No credentials in " + shadow, credentialsType);
PasswordType passwordType = credentialsType.getPassword();
assertNotNull("No password in " + shadow, passwordType);
ProtectedStringType protectedStringType = passwordType.getValue();
assertLdapPassword(protectedStringType, expectedPassword, shadow);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.CredentialsType in project midpoint by Evolveum.
the class TestOpenDj method assertShadowPassword.
protected void assertShadowPassword(ShadowType provisioningShadow) throws Exception {
CredentialsType credentials = provisioningShadow.getCredentials();
if (credentials == null) {
return;
}
PasswordType passwordType = credentials.getPassword();
if (passwordType == null) {
return;
}
ProtectedStringType passwordValue = passwordType.getValue();
assertNull("Unexpected password value in " + provisioningShadow + ": " + passwordValue, passwordValue);
}
Aggregations