use of com.evolveum.midpoint.xml.ns._public.common.common_3.SecurityPolicyType in project midpoint by Evolveum.
the class PageRegistrationBase method initSelfRegistrationConfiguration.
private void initSelfRegistrationConfiguration() {
SecurityPolicyType securityPolicy = resolveSecurityPolicy();
this.selfRegistrationDto = new SelfRegistrationDto();
try {
this.selfRegistrationDto.initSelfRegistrationDto(securityPolicy);
} catch (SchemaException e) {
LOGGER.error("Failed to initialize self registration configuration.", e);
getSession().error(createStringResource("PageSelfRegistration.selfRegistration.configuration.init.failed").getString());
throw new RestartResponseException(PageLogin.class);
}
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.SecurityPolicyType in project midpoint by Evolveum.
the class PageRegistrationBase method initResetCredentialsConfiguration.
private void initResetCredentialsConfiguration() {
// TODO: cleanup, the same as in the PageRegistrationBase
SecurityPolicyType securityPolicy = resolveSecurityPolicy();
this.resetPasswordPolicy = new ResetPolicyDto();
try {
this.resetPasswordPolicy.initResetPolicyDto(securityPolicy);
} catch (SchemaException e) {
LOGGER.error("Failed to initialize self registration configuration.", e);
getSession().error(createStringResource("PageSelfRegistration.selfRegistration.configuration.init.failed").getString());
throw new RestartResponseException(PageLogin.class);
}
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.SecurityPolicyType in project midpoint by Evolveum.
the class PageRegistrationBase method resolveSecurityPolicy.
private SecurityPolicyType resolveSecurityPolicy() {
SecurityPolicyType securityPolicy = runPrivileged(new Producer<SecurityPolicyType>() {
@Override
public SecurityPolicyType run() {
Task task = createAnonymousTask(OPERATION_GET_SECURITY_POLICY);
task.setChannel(SchemaConstants.CHANNEL_GUI_SELF_REGISTRATION_URI);
OperationResult result = new OperationResult(OPERATION_GET_SECURITY_POLICY);
try {
return getModelInteractionService().getSecurityPolicy(null, task, result);
} catch (ObjectNotFoundException | SchemaException e) {
LOGGER.error("Could not retrieve security policy");
return null;
}
}
});
if (securityPolicy == null) {
LOGGER.error("No security policy defined.");
getSession().error(createStringResource("PageSelfRegistration.securityPolicy.notFound").getString());
throw new RestartResponseException(PageLogin.class);
}
return securityPolicy;
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.SecurityPolicyType in project midpoint by Evolveum.
the class SelfRegistrationDto method initSelfRegistrationDto.
public void initSelfRegistrationDto(SecurityPolicyType securityPolicy) throws SchemaException {
if (securityPolicy == null) {
return;
}
SelfRegistrationPolicyType selfRegistration = getSelfRegistrationPolicy(securityPolicy);
if (selfRegistration == null) {
return;
}
this.name = selfRegistration.getName();
this.defaultRoles = selfRegistration.getDefaultRole();
this.initialLifecycleState = selfRegistration.getInitialLifecycleState();
this.requiredLifecycleState = selfRegistration.getRequiredLifecycleState();
this.formRef = selfRegistration.getFormRef();
AbstractAuthenticationPolicyType authPolicy = SecurityPolicyUtil.getAuthenticationPolicy(selfRegistration.getAdditionalAuthenticationName(), securityPolicy);
if (authPolicy instanceof MailAuthenticationPolicyType) {
this.mailAuthenticationPolicy = (MailAuthenticationPolicyType) authPolicy;
noncePolicy = SecurityPolicyUtil.getCredentialPolicy(((MailAuthenticationPolicyType) authPolicy).getMailNonce(), securityPolicy);
} else if (authPolicy instanceof SmsAuthenticationPolicyType) {
this.smsAuthenticationPolicy = (SmsAuthenticationPolicyType) authPolicy;
noncePolicy = SecurityPolicyUtil.getCredentialPolicy(((SmsAuthenticationPolicyType) authPolicy).getSmsNonce(), securityPolicy);
}
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.SecurityPolicyType in project midpoint by Evolveum.
the class SystemConfigurationDto method loadSecurityPolicy.
private ObjectViewDto<SecurityPolicyType> loadSecurityPolicy(SystemConfigurationType config) {
ObjectReferenceType securityPolicy = config.getGlobalSecurityPolicyRef();
if (securityPolicy != null) {
securityPolicyDto = new ObjectViewDto<SecurityPolicyType>(securityPolicy.getOid(), WebComponentUtil.getName(securityPolicy));
} else {
securityPolicyDto = new ObjectViewDto<SecurityPolicyType>();
}
securityPolicyDto.setType(SecurityPolicyType.class);
return securityPolicyDto;
}
Aggregations