class CrestAuditor {

    void auditAccessFailure(int resultCode, String message) {
        if (auditEventPublisher.isAuditing(realm, ACCESS_TOPIC, EventName.AM_ACCESS_OUTCOME)) {

            final long endTime = currentTimeMillis();
            final long elapsedTime = endTime - startTime;
            JsonValue detail = json(object(field(ACCESS_RESPONSE_DETAIL_REASON, message)));
            AMAccessAuditEventBuilder builder = auditEventFactory.accessEvent(realm)
                    .forHttpRequest(context, request)
                    .timestamp(endTime, auditEventPublisher.isLtzEnabled())
                    .transactionId(AuditRequestContext.getTransactionIdValue())
                    .eventName(EventName.AM_ACCESS_OUTCOME)
                    .component(component)
                    .responseWithDetail(FAILED, Integer.toString(resultCode), elapsedTime, MILLISECONDS, detail);
            addSessionDetailsFromSSOTokenContextIfNotNull(builder, context);

            if (ipAddressHeaderPropertyIsSet()) {
                setClientFromHttpContextHeaderIfExists(builder, context);
            }

            AuditEvent auditEvent = builder.toEvent();
            postProcessEvent(auditEvent);

            auditEventPublisher.tryPublish(ACCESS_TOPIC, auditEvent);
        }
    }

      CrestAuditor(Debug debug, AuditEventPublisher auditEventPublisher,
                 AuditEventFactory auditEventFactory, Context context, Request request);

}