Search in sources :

Example 11 with SecurityPolicyType

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);
    }
}
Also used : SchemaException(com.evolveum.midpoint.util.exception.SchemaException) RestartResponseException(org.apache.wicket.RestartResponseException) SecurityPolicyType(com.evolveum.midpoint.xml.ns._public.common.common_3.SecurityPolicyType)

Example 12 with SecurityPolicyType

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);
    }
}
Also used : SchemaException(com.evolveum.midpoint.util.exception.SchemaException) RestartResponseException(org.apache.wicket.RestartResponseException) ResetPolicyDto(com.evolveum.midpoint.web.page.forgetpassword.ResetPolicyDto) SecurityPolicyType(com.evolveum.midpoint.xml.ns._public.common.common_3.SecurityPolicyType)

Example 13 with SecurityPolicyType

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;
}
Also used : Task(com.evolveum.midpoint.task.api.Task) RestartResponseException(org.apache.wicket.RestartResponseException) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) SecurityPolicyType(com.evolveum.midpoint.xml.ns._public.common.common_3.SecurityPolicyType)

Example 14 with SecurityPolicyType

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);
    }
}
Also used : MailAuthenticationPolicyType(com.evolveum.midpoint.xml.ns._public.common.common_3.MailAuthenticationPolicyType) SmsAuthenticationPolicyType(com.evolveum.midpoint.xml.ns._public.common.common_3.SmsAuthenticationPolicyType) AbstractAuthenticationPolicyType(com.evolveum.midpoint.xml.ns._public.common.common_3.AbstractAuthenticationPolicyType) SelfRegistrationPolicyType(com.evolveum.midpoint.xml.ns._public.common.common_3.SelfRegistrationPolicyType)

Example 15 with SecurityPolicyType

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;
}
Also used : ObjectReferenceType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType) SecurityPolicyType(com.evolveum.midpoint.xml.ns._public.common.common_3.SecurityPolicyType)

Aggregations

SecurityPolicyType (com.evolveum.midpoint.xml.ns._public.common.common_3.SecurityPolicyType)13 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)6 ObjectReferenceType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType)6 ValuePolicyType (com.evolveum.midpoint.xml.ns._public.common.common_3.ValuePolicyType)5 CredentialsPolicyType (com.evolveum.midpoint.xml.ns._public.common.common_3.CredentialsPolicyType)4 RestartResponseException (org.apache.wicket.RestartResponseException)4 ObjectNotFoundException (com.evolveum.midpoint.util.exception.ObjectNotFoundException)3 MailAuthenticationPolicyType (com.evolveum.midpoint.xml.ns._public.common.common_3.MailAuthenticationPolicyType)3 NonceCredentialsPolicyType (com.evolveum.midpoint.xml.ns._public.common.common_3.NonceCredentialsPolicyType)3 SecurityQuestionsCredentialsPolicyType (com.evolveum.midpoint.xml.ns._public.common.common_3.SecurityQuestionsCredentialsPolicyType)3 SmsAuthenticationPolicyType (com.evolveum.midpoint.xml.ns._public.common.common_3.SmsAuthenticationPolicyType)3 AbstractAuthenticationPolicyType (com.evolveum.midpoint.xml.ns._public.common.common_3.AbstractAuthenticationPolicyType)2 PasswordCredentialsPolicyType (com.evolveum.midpoint.xml.ns._public.common.common_3.PasswordCredentialsPolicyType)2 ArrayList (java.util.ArrayList)2 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)1 Task (com.evolveum.midpoint.task.api.Task)1 ObjectPolicyConfigurationEditor (com.evolveum.midpoint.web.component.ObjectPolicyConfigurationEditor)1 AEPlevel (com.evolveum.midpoint.web.page.admin.configuration.dto.AEPlevel)1 ObjectViewDto (com.evolveum.midpoint.web.page.admin.dto.ObjectViewDto)1 MyPasswordQuestionsPanel (com.evolveum.midpoint.web.page.admin.home.component.MyPasswordQuestionsPanel)1