use of com.evolveum.prism.xml.ns._public.types_3.ProtectedStringType in project midpoint by Evolveum.
the class AbstractPasswordTest method test412InitializeRappDummyLifecycle.
@Test
public void test412InitializeRappDummyLifecycle() throws Exception {
final String TEST_NAME = "test412InitializeRappDummyLifecycle";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
Task task = createTask(TEST_NAME);
OperationResult result = task.getResult();
PrismObject<UserType> userBefore = getUser(USER_RAPP_OID);
display("User before", userBefore);
String accountLifecycleOid = getLinkRefOid(userBefore, RESOURCE_DUMMY_LIFECYCLE_OID);
ObjectDelta<ShadowType> shadowDelta = ObjectDelta.createEmptyModifyDelta(ShadowType.class, accountLifecycleOid, prismContext);
ProtectedStringType passwordPs = new ProtectedStringType();
passwordPs.setClearValue(USER_PASSWORD_VALID_1);
shadowDelta.addModificationReplaceProperty(SchemaConstants.PATH_PASSWORD_VALUE, passwordPs);
shadowDelta.addModificationReplaceProperty(ObjectType.F_LIFECYCLE_STATE, SchemaConstants.LIFECYCLE_ACTIVE);
// WHEN
TestUtil.displayWhen(TEST_NAME);
executeChanges(shadowDelta, null, task, result);
// THEN
TestUtil.displayThen(TEST_NAME);
result.computeStatus();
TestUtil.assertSuccess(result);
PrismObject<UserType> userAfter = getUser(USER_RAPP_OID);
display("User after", userAfter);
assertLinks(userAfter, 3);
accountLifecycleOid = getLinkRefOid(userAfter, RESOURCE_DUMMY_LIFECYCLE_OID);
assertDummyAccount(RESOURCE_DUMMY_LIFECYCLE_NAME, USER_RAPP_USERNAME, USER_RAPP_FULLNAME, true);
assertDummyPassword(RESOURCE_DUMMY_LIFECYCLE_NAME, USER_RAPP_USERNAME, USER_PASSWORD_VALID_1);
PrismObject<ShadowType> accountShadowLifecycle = repositoryService.getObject(ShadowType.class, accountLifecycleOid, null, result);
display("Repo shadow LIFECYCLE", accountShadowLifecycle);
assertAccountShadowRepo(accountShadowLifecycle, accountLifecycleOid, USER_RAPP_USERNAME, getDummyResourceType(RESOURCE_DUMMY_LIFECYCLE_NAME));
assertShadowLifecycle(accountShadowLifecycle, SchemaConstants.LIFECYCLE_ACTIVE);
assertDummyAccount(RESOURCE_DUMMY_RED_NAME, USER_RAPP_USERNAME, USER_RAPP_FULLNAME, true);
assertDummyPassword(RESOURCE_DUMMY_RED_NAME, USER_RAPP_USERNAME, USER_PASSWORD_VALID_1);
assertUserPassword(userAfter, USER_PASSWORD_VALID_1);
assertDefaultDummyAccount(USER_RAPP_USERNAME, USER_RAPP_FULLNAME, true);
assertDummyPassword(null, USER_RAPP_USERNAME, USER_PASSWORD_VALID_1);
// RED shadows
String accountRedOid = getLinkRefOid(userAfter, RESOURCE_DUMMY_RED_OID);
PrismObject<ShadowType> accountShadowRed = repositoryService.getObject(ShadowType.class, accountRedOid, null, result);
display("Repo shadow RED", accountShadowRed);
assertAccountShadowRepo(accountShadowRed, accountRedOid, USER_RAPP_USERNAME, getDummyResourceType(RESOURCE_DUMMY_RED_NAME));
assertShadowLifecycle(accountShadowRed, SchemaConstants.LIFECYCLE_ACTIVE);
PrismObject<ShadowType> accountModelRed = modelService.getObject(ShadowType.class, accountRedOid, null, task, result);
display("Model shadow RED", accountModelRed);
assertAccountShadowModel(accountModelRed, accountRedOid, USER_RAPP_USERNAME, getDummyResourceType(RESOURCE_DUMMY_RED_NAME));
assertShadowLifecycle(accountModelRed, SchemaConstants.LIFECYCLE_ACTIVE);
// DEFAULT shadows
String accountDefaultOid = getLinkRefOid(userAfter, RESOURCE_DUMMY_OID);
PrismObject<ShadowType> accountModel = modelService.getObject(ShadowType.class, accountDefaultOid, null, task, result);
assertDummyAccountShadowModel(accountModel, accountDefaultOid, USER_RAPP_USERNAME, USER_RAPP_FULLNAME);
assertShadowLifecycle(accountModel, null);
PrismObject<ShadowType> accountShadow = repositoryService.getObject(ShadowType.class, accountDefaultOid, null, result);
assertDummyAccountShadowRepo(accountShadow, accountDefaultOid, USER_RAPP_USERNAME);
assertShadowLifecycle(accountShadow, null);
}
use of com.evolveum.prism.xml.ns._public.types_3.ProtectedStringType in project midpoint by Evolveum.
the class AbstractPasswordTest method test060CheckJackPasswordModelInteraction.
@Test
public void test060CheckJackPasswordModelInteraction() throws Exception {
final String TEST_NAME = "test060CheckJackPasswordModelInteraction";
TestUtil.displayTestTile(this, TEST_NAME);
if (getPasswordStorageType() == CredentialsStorageTypeType.NONE) {
// Nothing to check in this case
return;
}
// GIVEN
Task task = createTask(AbstractPasswordTest.class.getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
// WHEN, THEN
ProtectedStringType userPasswordPsGood = new ProtectedStringType();
userPasswordPsGood.setClearValue(USER_PASSWORD_1_CLEAR);
assertTrue("Good password check failed", modelInteractionService.checkPassword(USER_JACK_OID, userPasswordPsGood, task, result));
ProtectedStringType userPasswordPsBad = new ProtectedStringType();
userPasswordPsBad.setClearValue("this is not a password");
assertFalse("Bad password check failed", modelInteractionService.checkPassword(USER_JACK_OID, userPasswordPsBad, task, result));
ProtectedStringType userPasswordPsEmpty = new ProtectedStringType();
assertFalse("Empty password check failed", modelInteractionService.checkPassword(USER_JACK_OID, userPasswordPsEmpty, task, result));
assertFalse("Null password check failed", modelInteractionService.checkPassword(USER_JACK_OID, null, task, result));
}
use of com.evolveum.prism.xml.ns._public.types_3.ProtectedStringType in project midpoint by Evolveum.
the class AbstractPasswordTest method test112ModifyJackPasswordUserAndAccount.
/**
* Modify both user and account password. As password outbound mapping is weak the user should have its own password
* and account should have its own password.
*/
@Test
public void test112ModifyJackPasswordUserAndAccount() throws Exception {
final String TEST_NAME = "test112ModifyJackPasswordUserAndAccount";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
Task task = createTask(TEST_NAME);
OperationResult result = task.getResult();
assumeAssignmentPolicy(AssignmentPolicyEnforcementType.FULL);
ProtectedStringType userPasswordPs4 = new ProtectedStringType();
userPasswordPs4.setClearValue(USER_PASSWORD_4_CLEAR);
ObjectDelta<UserType> userDelta = createModifyUserReplaceDelta(USER_JACK_OID, PASSWORD_VALUE_PATH, userPasswordPs4);
ProtectedStringType userPasswordPs5 = new ProtectedStringType();
userPasswordPs5.setClearValue(USER_PASSWORD_5_CLEAR);
ObjectDelta<ShadowType> accountDelta = createModifyAccountShadowReplaceDelta(accountJackOid, getDummyResourceObject(), PASSWORD_VALUE_PATH, userPasswordPs5);
Collection<ObjectDelta<? extends ObjectType>> deltas = MiscSchemaUtil.createCollection(accountDelta, userDelta);
lastPasswordChangeStart = clock.currentTimeXMLGregorianCalendar();
// WHEN
modelService.executeChanges(deltas, null, task, result);
// THEN
result.computeStatus();
TestUtil.assertSuccess(result);
lastPasswordChangeEnd = clock.currentTimeXMLGregorianCalendar();
PrismObject<UserType> userJack = getUser(USER_JACK_OID);
display("User after change execution", userJack);
assertUserJack(userJack, "Jack Sparrow");
// User should still have old password
assertUserPassword(userJack, USER_PASSWORD_4_CLEAR);
// Account has new password
assertDummyPassword(ACCOUNT_JACK_DUMMY_USERNAME, USER_PASSWORD_5_CLEAR);
assertPasswordMetadata(userJack, false, lastPasswordChangeStart, lastPasswordChangeEnd);
}
use of com.evolveum.prism.xml.ns._public.types_3.ProtectedStringType in project midpoint by Evolveum.
the class TestPasswordAuthenticationEvaluator method getGuybrushPassword.
private ProtectedStringType getGuybrushPassword() {
ProtectedStringType protectedString = new ProtectedStringType();
protectedString.setClearValue(USER_GUYBRUSH_PASSWORD);
return protectedString;
}
use of com.evolveum.prism.xml.ns._public.types_3.ProtectedStringType in project midpoint by Evolveum.
the class TestSecurityQuestionsAuthenticationEvaluator method getSecurityQuestionAnswer.
private SecurityQuestionAnswerType getSecurityQuestionAnswer() {
SecurityQuestionAnswerType questionAnswer = new SecurityQuestionAnswerType();
questionAnswer.setQuestionIdentifier(SECURITY_QUESTION_ID);
ProtectedStringType protectedString = new ProtectedStringType();
protectedString.setClearValue(SECURITY_QUESTION_GOOD_ANSWER_GUYBRUSH);
questionAnswer.setQuestionAnswer(protectedString);
return questionAnswer;
}
Aggregations