Search in sources :

Example 6 with CrService

use of password.pwm.util.operations.CrService in project pwm by pwm-project.

the class RestChallengesServer method doDeleteChallengeData.

private RestResultBean doDeleteChallengeData(final RestRequest restRequest, final String username) throws PwmUnrecoverableException {
    final TargetUserIdentity targetUserIdentity = RestUtility.resolveRequestedUsername(restRequest, username);
    try {
        final ChaiUser chaiUser;
        final String userGUID;
        chaiUser = targetUserIdentity.getChaiUser();
        userGUID = LdapOperationsHelper.readLdapGuidValue(restRequest.getPwmApplication(), restRequest.getSessionLabel(), targetUserIdentity.getUserIdentity(), false);
        final CrService crService = restRequest.getPwmApplication().getCrService();
        crService.clearResponses(restRequest.getSessionLabel(), targetUserIdentity.getUserIdentity(), chaiUser, userGUID);
        // update statistics
        StatisticsManager.incrementStat(restRequest.getPwmApplication(), Statistic.REST_CHALLENGES);
        return RestResultBean.forSuccessMessage(restRequest, Message.Success_Unknown);
    } catch (Exception e) {
        final String errorMsg = "unexpected error delete responses: " + e.getMessage();
        final ErrorInformation errorInformation = new ErrorInformation(PwmError.ERROR_UNKNOWN, errorMsg);
        return RestResultBean.fromError(restRequest, errorInformation);
    }
}
Also used : ErrorInformation(password.pwm.error.ErrorInformation) ChaiUser(com.novell.ldapchai.ChaiUser) CrService(password.pwm.util.operations.CrService) PwmUnrecoverableException(password.pwm.error.PwmUnrecoverableException) ChaiException(com.novell.ldapchai.exception.ChaiException) PwmOperationalException(password.pwm.error.PwmOperationalException) IOException(java.io.IOException)

Aggregations

CrService (password.pwm.util.operations.CrService)6 ChaiUser (com.novell.ldapchai.ChaiUser)4 ErrorInformation (password.pwm.error.ErrorInformation)4 PwmUnrecoverableException (password.pwm.error.PwmUnrecoverableException)4 ChaiException (com.novell.ldapchai.exception.ChaiException)3 UserIdentity (password.pwm.bean.UserIdentity)3 IOException (java.io.IOException)2 ResponseInfoBean (password.pwm.bean.ResponseInfoBean)2 ChallengeProfile (password.pwm.config.profile.ChallengeProfile)2 PwmPasswordPolicy (password.pwm.config.profile.PwmPasswordPolicy)2 PwmOperationalException (password.pwm.error.PwmOperationalException)2 RestMethodHandler (password.pwm.ws.server.RestMethodHandler)2 ChallengeSet (com.novell.ldapchai.cr.ChallengeSet)1 ResponseSet (com.novell.ldapchai.cr.ResponseSet)1 Locale (java.util.Locale)1 Timer (java.util.Timer)1 TimerTask (java.util.TimerTask)1 HelpdeskClearResponseMode (password.pwm.config.option.HelpdeskClearResponseMode)1 HelpdeskProfile (password.pwm.config.profile.HelpdeskProfile)1 AuditRecordFactory (password.pwm.svc.event.AuditRecordFactory)1