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);
}
}
Aggregations