use of com.evolveum.midpoint.xml.ns._public.common.common_3.AuthenticationBehavioralDataType in project midpoint by Evolveum.
the class PersonalInfoPanel method loadPersonalInfo.
private PersonalInfoDto loadPersonalInfo() {
FocusType focus = AuthUtil.getPrincipalUser().getFocus();
AuthenticationBehavioralDataType behaviour = focus.getBehavior() != null ? focus.getBehavior().getAuthentication() : null;
PersonalInfoDto dto = new PersonalInfoDto();
if (behaviour != null) {
if (behaviour.getPreviousSuccessfulLogin() != null) {
dto.setLastLoginDate(MiscUtil.asDate(behaviour.getPreviousSuccessfulLogin().getTimestamp()));
dto.setLastLoginFrom(behaviour.getPreviousSuccessfulLogin().getFrom());
}
if (behaviour.getLastFailedLogin() != null) {
dto.setLastFailDate(MiscUtil.asDate(behaviour.getLastFailedLogin().getTimestamp()));
dto.setLastFailFrom(behaviour.getLastFailedLogin().getFrom());
}
}
Task task = getPageBase().createSimpleTask(OPERATION_GET_CREDENTIALS_POLICY);
CredentialsPolicyType credentialsPolicyType = WebComponentUtil.getPasswordCredentialsPolicy(focus.asPrismContainer(), getPageBase(), task);
Duration maxAge = credentialsPolicyType != null && credentialsPolicyType.getPassword() != null ? credentialsPolicyType.getPassword().getMaxAge() : null;
if (maxAge != null) {
MetadataType credentialMetadata = focus.getCredentials() != null && focus.getCredentials().getPassword() != null ? focus.getCredentials().getPassword().getMetadata() : null;
XMLGregorianCalendar changeTimestamp = MiscSchemaUtil.getChangeTimestamp(credentialMetadata);
if (changeTimestamp != null) {
XMLGregorianCalendar passwordValidUntil = XmlTypeConverter.addDuration(changeTimestamp, maxAge);
dto.setPasswordExp(MiscUtil.asDate(passwordValidUntil));
}
}
return dto;
}
Aggregations