protected AuditRecord(final Date timestamp, final AuditEvent eventCode, final String message) { this.type = eventCode.getType(); this.eventCode = eventCode; this.message = message; this.timestamp = timestamp; this.guid = PwmRandom.getInstance().randomUUID().toString(); }
@Override public void log(AuditEvent auditEvent) { String origin = auditEvent.getOrigin(); String data = auditEvent.getData(); origin = origin == null ? "" : origin; origin = origin.length() > 255 ? origin.substring(0, 255) : origin; data = data == null ? "" : data; data = data.length() > 255 ? data.substring(0, 255) : data; template.update( "insert into sec_audit (principal_id, event_type, origin, event_data) values (?,?,?,?)", auditEvent.getPrincipalId(), auditEvent.getType().getCode(), auditEvent.getOrigin(), auditEvent.getData()); }
protected AuditRecord(final AuditEvent eventCode, final String message) { this(new Date(), eventCode, message); this.xdasOutcome = eventCode.getXdasOutcome(); this.xdasTaxonomy = eventCode.getXdasTaxonomy(); }
@SuppressWarnings("unused") private void onAuditEventViolations(@Observes @AuditViolation AuditEvent event) { System.out.println("recorded " + event.getClass().getName()); auditViolationEvents.add(event); }