Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save athiththan11/2b8b5690bf65b7d16eb2973bbaa22442 to your computer and use it in GitHub Desktop.
Save athiththan11/2b8b5690bf65b7d16eb2973bbaa22442 to your computer and use it in GitHub Desktop.
Handling published events using HandleEvent() method
@Override
public void handleEvent(Event event) throws IdentityEventException {
if (log.isDebugEnabled()) {
log.debug("handleEvent() invoked");
}
if (IdentityEventConstants.Event.PRE_UPDATE_CREDENTIAL.equals(event.getEventName())
|| IdentityEventConstants.Event.PRE_UPDATE_CREDENTIAL_BY_ADMIN.equals(event.getEventName())) {
Object credential = event.getEventProperties().get(IdentityEventConstants.EventProperty.CREDENTIAL);
if (!DefaultDefectivePasswordValidator.getInstance().validate(credential)) {
if (log.isDebugEnabled()) {
log.debug("given password is defective");
}
throw Utils.handleEventException(
DefectivePasswordValidatorConstants.ErrorMessages.ERROR_CODE_CRACKED_PASSWORD_VALIDATION, null);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment