Search in sources :

Example 6 with ChallengeProfile

use of password.pwm.config.profile.ChallengeProfile in project pwm by pwm-project.

the class SetupResponsesServlet method initializeBean.

private void initializeBean(final PwmRequest pwmRequest, final SetupResponsesBean setupResponsesBean) throws PwmUnrecoverableException {
    if (pwmRequest.getPwmSession().getUserInfo().getResponseInfoBean() != null) {
        setupResponsesBean.setHasExistingResponses(true);
    }
    final ChallengeProfile challengeProfile = pwmRequest.getPwmSession().getUserInfo().getChallengeProfile();
    if (setupResponsesBean.getResponseData() == null) {
        // setup user challenge data
        final ChallengeSet userChallengeSet = challengeProfile.getChallengeSet();
        final int minRandomSetup = challengeProfile.getMinRandomSetup();
        final SetupResponsesBean.SetupData userSetupData = populateSetupData(userChallengeSet, minRandomSetup);
        setupResponsesBean.setResponseData(userSetupData);
    }
    if (setupResponsesBean.getHelpdeskResponseData() == null) {
        // setup helpdesk challenge data
        final ChallengeSet helpdeskChallengeSet = challengeProfile.getHelpdeskChallengeSet();
        if (helpdeskChallengeSet == null) {
            setupResponsesBean.setHelpdeskResponseData(new SetupResponsesBean.SetupData());
        } else {
            final int minRandomHelpdeskSetup = challengeProfile.getMinHelpdeskRandomsSetup();
            final SetupResponsesBean.SetupData helpdeskSetupData = populateSetupData(helpdeskChallengeSet, minRandomHelpdeskSetup);
            setupResponsesBean.setHelpdeskResponseData(helpdeskSetupData);
        }
    }
}
Also used : ChallengeSet(com.novell.ldapchai.cr.ChallengeSet) ChallengeProfile(password.pwm.config.profile.ChallengeProfile) SetupResponsesBean(password.pwm.http.bean.SetupResponsesBean)

Aggregations

ChallengeProfile (password.pwm.config.profile.ChallengeProfile)6 ChallengeSet (com.novell.ldapchai.cr.ChallengeSet)4 ChaiUser (com.novell.ldapchai.ChaiUser)3 ChaiException (com.novell.ldapchai.exception.ChaiException)3 ErrorInformation (password.pwm.error.ErrorInformation)3 PwmUnrecoverableException (password.pwm.error.PwmUnrecoverableException)3 ResponseInfoBean (password.pwm.bean.ResponseInfoBean)2 UserIdentity (password.pwm.bean.UserIdentity)2 CrService (password.pwm.util.operations.CrService)2 RestMethodHandler (password.pwm.ws.server.RestMethodHandler)2 ChaiChallengeSet (com.novell.ldapchai.cr.ChaiChallengeSet)1 ResponseSet (com.novell.ldapchai.cr.ResponseSet)1 BufferedReader (java.io.BufferedReader)1 File (java.io.File)1 FileInputStream (java.io.FileInputStream)1 IOException (java.io.IOException)1 InputStreamReader (java.io.InputStreamReader)1 Locale (java.util.Locale)1 PwmApplication (password.pwm.PwmApplication)1 Configuration (password.pwm.config.Configuration)1