use of com.evolveum.midpoint.xml.ns._public.common.common_3.CredentialsType in project midpoint by Evolveum.
the class PersonalInfoPanel method loadPersonalInfo.
private PersonalInfoDto loadPersonalInfo() {
UserType user = SecurityUtils.getPrincipalUser().getUser();
CredentialsType credentials = user.getCredentials();
PersonalInfoDto dto = new PersonalInfoDto();
if (credentials != null) {
PasswordType password = credentials.getPassword();
if (password.getPreviousSuccessfulLogin() != null) {
dto.setLastLoginDate(MiscUtil.asDate(password.getPreviousSuccessfulLogin().getTimestamp()));
dto.setLastLoginFrom(password.getPreviousSuccessfulLogin().getFrom());
}
if (password.getLastFailedLogin() != null) {
dto.setLastFailDate(MiscUtil.asDate(password.getLastFailedLogin().getTimestamp()));
dto.setLastFailFrom(password.getLastFailedLogin().getFrom());
}
}
if (user.getActivation() != null) {
//todo fix, this is not password expiration date...
dto.setPasswordExp(MiscUtil.asDate(user.getActivation().getValidTo()));
}
return dto;
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.CredentialsType in project midpoint by Evolveum.
the class PageSelfRegistration method createCredentials.
private void createCredentials(UserType user, NonceCredentialsPolicyType noncePolicy, Task task, OperationResult result) throws ExpressionEvaluationException, SchemaException, ObjectNotFoundException {
NonceType nonceType = createNonce(noncePolicy, task, result);
// PasswordType password = createPassword();
CredentialsType credentials = user.getCredentials();
if (user.getCredentials() == null) {
credentials = new CredentialsType();
user.setCredentials(credentials);
}
credentials.setNonce(nonceType);
// credentials.setPassword(password);
// return credentials;
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.CredentialsType in project midpoint by Evolveum.
the class FocusTypeUtil method getPasswordValue.
public static ProtectedStringType getPasswordValue(UserType user) {
if (user == null) {
return null;
}
CredentialsType creds = user.getCredentials();
if (creds == null) {
return null;
}
PasswordType passwd = creds.getPassword();
if (passwd == null) {
return null;
}
return passwd.getValue();
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.CredentialsType in project midpoint by Evolveum.
the class ModelClientUtil method createPasswordCredentials.
public static CredentialsType createPasswordCredentials(String password) {
CredentialsType credentialsType = new CredentialsType();
credentialsType.setPassword(createPasswordType(password));
return credentialsType;
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.CredentialsType in project midpoint by Evolveum.
the class TestAbstractRestService method test600modifySecurityQuestionAnswer.
@Test
public void test600modifySecurityQuestionAnswer() throws Exception {
final String TEST_NAME = "test600modifySecurityQuestionAnswer";
displayTestTile(this, TEST_NAME);
WebClient client = prepareClient();
client.path("/users/" + USER_DARTHADDER_OID);
getDummyAuditService().clear();
TestUtil.displayWhen(TEST_NAME);
Response response = client.post(getRequestFile(MODIFICATION_REPLACE_ANSWER));
TestUtil.displayThen(TEST_NAME);
displayResponse(response);
traceResponse(response);
assertEquals("Expected 204 but got " + response.getStatus(), 204, response.getStatus());
IntegrationTestTools.display("Audit", getDummyAuditService());
getDummyAuditService().assertRecords(4);
getDummyAuditService().assertLoginLogout(SchemaConstants.CHANNEL_REST_URI);
getDummyAuditService().assertHasDelta(1, ChangeType.MODIFY, UserType.class);
TestUtil.displayWhen(TEST_NAME);
response = client.get();
TestUtil.displayThen(TEST_NAME);
displayResponse(response);
assertEquals("Expected 200 but got " + response.getStatus(), 200, response.getStatus());
UserType userDarthadder = response.readEntity(UserType.class);
CredentialsType credentials = userDarthadder.getCredentials();
assertNotNull("No credentials in user. Something is wrong.", credentials);
SecurityQuestionsCredentialsType securityQuestions = credentials.getSecurityQuestions();
assertNotNull("No security questions defined for user. Something is wrong.", securityQuestions);
List<SecurityQuestionAnswerType> secQuestionAnswers = securityQuestions.getQuestionAnswer();
assertEquals("Expected just one question-answer couple, but found " + secQuestionAnswers.size(), 1, secQuestionAnswers.size());
SecurityQuestionAnswerType secQuestionAnswer = secQuestionAnswers.iterator().next();
String decrypted = getPrismContext().getDefaultProtector().decryptString(secQuestionAnswer.getQuestionAnswer());
assertEquals("Unexpected answer " + decrypted + ". Expected 'newAnswer'.", "newAnswer", decrypted);
}
Aggregations