use of password.pwm.svc.event.AuditRecordFactory in project pwm by pwm-project.
the class ActivateUserServlet method handleAgreeRequest.
@ActionHandler(action = "agree")
public ProcessStatus handleAgreeRequest(final PwmRequest pwmRequest) throws ServletException, IOException, PwmUnrecoverableException, ChaiUnavailableException {
LOGGER.debug(pwmRequest, "user accepted agreement");
final ActivateUserBean activateUserBean = activateUserBean(pwmRequest);
if (!activateUserBean.isAgreementPassed()) {
activateUserBean.setAgreementPassed(true);
final AuditRecord auditRecord = new AuditRecordFactory(pwmRequest).createUserAuditRecord(AuditEvent.AGREEMENT_PASSED, pwmRequest.getUserInfoIfLoggedIn(), pwmRequest.getSessionLabel(), "ActivateUser");
pwmRequest.getPwmApplication().getAuditManager().submit(auditRecord);
}
return ProcessStatus.Continue;
}
use of password.pwm.svc.event.AuditRecordFactory in project pwm by pwm-project.
the class ChangePasswordServlet method processAgreeAction.
@ActionHandler(action = "agree")
ProcessStatus processAgreeAction(final PwmRequest pwmRequest) throws ServletException, PwmUnrecoverableException, IOException, ChaiUnavailableException {
final ChangePasswordBean changePasswordBean = pwmRequest.getPwmApplication().getSessionStateService().getBean(pwmRequest, ChangePasswordBean.class);
LOGGER.debug(pwmRequest, "user accepted password change agreement");
if (!changePasswordBean.isAgreementPassed()) {
changePasswordBean.setAgreementPassed(true);
final AuditRecord auditRecord = new AuditRecordFactory(pwmRequest).createUserAuditRecord(AuditEvent.AGREEMENT_PASSED, pwmRequest.getUserInfoIfLoggedIn(), pwmRequest.getSessionLabel(), "ChangePassword");
pwmRequest.getPwmApplication().getAuditManager().submit(auditRecord);
}
return ProcessStatus.Continue;
}
use of password.pwm.svc.event.AuditRecordFactory in project pwm by pwm-project.
the class UpdateProfileServlet method handleAgreeRequest.
@ActionHandler(action = "agree")
ProcessStatus handleAgreeRequest(final PwmRequest pwmRequest) throws ServletException, IOException, PwmUnrecoverableException, ChaiUnavailableException {
LOGGER.debug(pwmRequest, "user accepted agreement");
final UpdateProfileBean updateProfileBean = getBean(pwmRequest);
if (!updateProfileBean.isAgreementPassed()) {
updateProfileBean.setAgreementPassed(true);
final AuditRecord auditRecord = new AuditRecordFactory(pwmRequest).createUserAuditRecord(AuditEvent.AGREEMENT_PASSED, pwmRequest.getUserInfoIfLoggedIn(), pwmRequest.getSessionLabel(), "UpdateProfile");
pwmRequest.getPwmApplication().getAuditManager().submit(auditRecord);
}
return ProcessStatus.Continue;
}
use of password.pwm.svc.event.AuditRecordFactory in project pwm by pwm-project.
the class TokenService method markTokenAsClaimed.
private void markTokenAsClaimed(final TokenKey tokenKey, final PwmSession pwmSession, final TokenPayload tokenPayload) throws PwmUnrecoverableException {
if (tokenPayload == null || tokenPayload.getUserIdentity() == null) {
return;
}
final boolean removeOnClaim = Boolean.parseBoolean(configuration.readAppProperty(AppProperty.TOKEN_REMOVE_ON_CLAIM));
if (removeOnClaim) {
try {
LOGGER.trace(pwmSession, "removing claimed token: " + tokenPayload.toDebugString());
tokenMachine.removeToken(tokenKey);
} catch (PwmOperationalException e) {
LOGGER.error(pwmSession, "error clearing claimed token: " + e.getMessage());
}
}
final AuditRecord auditRecord = new AuditRecordFactory(pwmApplication).createUserAuditRecord(AuditEvent.TOKEN_CLAIMED, tokenPayload.getUserIdentity(), pwmSession.getLabel(), JsonUtil.serialize(tokenPayload));
pwmApplication.getAuditManager().submit(auditRecord);
StatisticsManager.incrementStat(pwmApplication, Statistic.TOKENS_PASSSED);
}
use of password.pwm.svc.event.AuditRecordFactory in project pwm by pwm-project.
the class TokenService method generateNewToken.
public String generateNewToken(final TokenPayload tokenPayload, final SessionLabel sessionLabel) throws PwmUnrecoverableException, PwmOperationalException {
checkStatus();
final String tokenKey;
try {
tokenKey = tokenMachine.generateToken(sessionLabel, tokenPayload);
tokenMachine.storeToken(tokenMachine.keyFromKey(tokenKey), tokenPayload);
} catch (PwmException e) {
final String errorMsg = "unexpected error trying to store token in datastore: " + e.getMessage();
final ErrorInformation errorInformation = new ErrorInformation(e.getError(), errorMsg);
throw new PwmOperationalException(errorInformation);
}
LOGGER.trace(sessionLabel, "generated token with payload: " + tokenPayload.toDebugString());
final AuditRecord auditRecord = new AuditRecordFactory(pwmApplication).createUserAuditRecord(AuditEvent.TOKEN_ISSUED, tokenPayload.getUserIdentity(), sessionLabel, JsonUtil.serialize(tokenPayload));
pwmApplication.getAuditManager().submit(auditRecord);
return tokenKey;
}
Aggregations