Search in sources :

Example 1 with SecurityQuestionsCredentialsPolicyType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.SecurityQuestionsCredentialsPolicyType in project midpoint by Evolveum.

the class SecurityHelper method postProcessSecurityPolicy.

private void postProcessSecurityPolicy(SecurityPolicyType securityPolicyType, Task task, OperationResult result) {
    CredentialsPolicyType creds = securityPolicyType.getCredentials();
    if (creds != null) {
        PasswordCredentialsPolicyType passwd = creds.getPassword();
        if (passwd != null) {
            postProcessPasswordCredentialPolicy(securityPolicyType, passwd, task, result);
        }
        for (NonceCredentialsPolicyType nonce : creds.getNonce()) {
            postProcessCredentialPolicy(securityPolicyType, nonce, "nonce credential policy", task, result);
        }
        SecurityQuestionsCredentialsPolicyType securityQuestions = creds.getSecurityQuestions();
        if (securityQuestions != null) {
            postProcessCredentialPolicy(securityPolicyType, securityQuestions, "security questions credential policy", task, result);
        }
    }
}
Also used : PasswordCredentialsPolicyType(com.evolveum.midpoint.xml.ns._public.common.common_3.PasswordCredentialsPolicyType) NonceCredentialsPolicyType(com.evolveum.midpoint.xml.ns._public.common.common_3.NonceCredentialsPolicyType) SecurityQuestionsCredentialsPolicyType(com.evolveum.midpoint.xml.ns._public.common.common_3.SecurityQuestionsCredentialsPolicyType) CredentialsPolicyType(com.evolveum.midpoint.xml.ns._public.common.common_3.CredentialsPolicyType) PasswordCredentialsPolicyType(com.evolveum.midpoint.xml.ns._public.common.common_3.PasswordCredentialsPolicyType) NonceCredentialsPolicyType(com.evolveum.midpoint.xml.ns._public.common.common_3.NonceCredentialsPolicyType) SecurityQuestionsCredentialsPolicyType(com.evolveum.midpoint.xml.ns._public.common.common_3.SecurityQuestionsCredentialsPolicyType)

Example 2 with SecurityQuestionsCredentialsPolicyType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.SecurityQuestionsCredentialsPolicyType in project midpoint by Evolveum.

the class SecurityQuestionAuthneticationEvaluatorImpl method passwordMatches.

@Override
protected boolean passwordMatches(ConnectionEnvironment connEnv, MidPointPrincipal principal, SecurityQuestionsCredentialsType passwordType, SecurityQuestionsAuthenticationContext authCtx) {
    SecurityQuestionsCredentialsPolicyType policy = authCtx.getPolicy();
    Integer iNumberOfQuestions = policy.getQuestionNumber();
    int numberOfQuestions = 0;
    if (iNumberOfQuestions != null) {
        numberOfQuestions = iNumberOfQuestions.intValue();
    }
    Map<String, String> enteredQuestionsAnswers = authCtx.getQuestionAnswerMap();
    if (numberOfQuestions > enteredQuestionsAnswers.size()) {
        return false;
    }
    List<SecurityQuestionAnswerType> quetionsAnswers = passwordType.getQuestionAnswer();
    int matched = 0;
    for (SecurityQuestionAnswerType questionAnswer : quetionsAnswers) {
        String enteredAnswer = enteredQuestionsAnswers.get(questionAnswer.getQuestionIdentifier());
        if (StringUtils.isNotBlank(enteredAnswer)) {
            if (decryptAndMatch(connEnv, principal, questionAnswer.getQuestionAnswer(), enteredAnswer)) {
                matched++;
            }
        }
    }
    return matched > 0 && matched >= numberOfQuestions;
}
Also used : SecurityQuestionsCredentialsPolicyType(com.evolveum.midpoint.xml.ns._public.common.common_3.SecurityQuestionsCredentialsPolicyType) SecurityQuestionAnswerType(com.evolveum.midpoint.xml.ns._public.common.common_3.SecurityQuestionAnswerType)

Example 3 with SecurityQuestionsCredentialsPolicyType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.SecurityQuestionsCredentialsPolicyType in project midpoint by Evolveum.

the class SecurityQuestionAuthneticationEvaluatorImpl method getEffectiveCredentialPolicy.

@Override
protected CredentialPolicyType getEffectiveCredentialPolicy(SecurityPolicyType securityPolicy, SecurityQuestionsAuthenticationContext authnCtx) throws SchemaException {
    SecurityQuestionsCredentialsPolicyType policy = authnCtx.getPolicy();
    if (policy == null) {
        policy = SecurityUtil.getEffectiveSecurityQuestionsCredentialsPolicy(securityPolicy);
    }
    authnCtx.setPolicy(policy);
    return policy;
}
Also used : SecurityQuestionsCredentialsPolicyType(com.evolveum.midpoint.xml.ns._public.common.common_3.SecurityQuestionsCredentialsPolicyType)

Aggregations

SecurityQuestionsCredentialsPolicyType (com.evolveum.midpoint.xml.ns._public.common.common_3.SecurityQuestionsCredentialsPolicyType)3 CredentialsPolicyType (com.evolveum.midpoint.xml.ns._public.common.common_3.CredentialsPolicyType)1 NonceCredentialsPolicyType (com.evolveum.midpoint.xml.ns._public.common.common_3.NonceCredentialsPolicyType)1 PasswordCredentialsPolicyType (com.evolveum.midpoint.xml.ns._public.common.common_3.PasswordCredentialsPolicyType)1 SecurityQuestionAnswerType (com.evolveum.midpoint.xml.ns._public.common.common_3.SecurityQuestionAnswerType)1