class AuthenticationProcessEventAuditor extends AbstractAuthenticationEventAuditor {

    public void auditLogout(SSOToken token) {
        String realm = getRealmFromToken(token);

        if (eventPublisher.isAuditing(realm, AUTHENTICATION_TOPIC, AM_LOGOUT)) {
            String principalName;
            try {
                Principal principal = token == null ? null : token.getPrincipal();
                principalName = principal == null ? null : DNUtils.DNtoName(principal.getName());
            } catch (SSOException e) {
                principalName = null;
            }

            AuthenticationAuditEntry entryDetail = new AuthenticationAuditEntry();
            entryDetail.setModuleId(getSSOTokenProperty(token, AUTH_TYPE));

            String host = getSSOTokenProperty(token, HOST);
            if (isNotEmpty(host)) {
                entryDetail.addInfo(IP_ADDRESS, host);
            }

            String trackingId = getTrackingIdFromSSOToken(token);
            String userId = AMAuditEventBuilderUtils.getUserId(token);

            AMAuthenticationAuditEventBuilder builder = eventFactory.authenticationEvent(realm)
                    .timestamp(System.currentTimeMillis(), eventPublisher.isLtzEnabled())
                    .transactionId(getTransactionIdValue())
                    .component(AUTHENTICATION)
                    .eventName(AM_LOGOUT)
                    .result(SUCCESSFUL)
                    .entry(entryDetail)
                    .trackingId(trackingId == null ? "" : trackingId)
                    .userId(userId == null ? "" : userId)
                    .principal(principalName);

            eventPublisher.tryPublish(AUTHENTICATION_TOPIC, builder.toEvent());
        }
    }

    @Inject public  AuthenticationProcessEventAuditor(AuditEventPublisher eventPublisher, AuditEventFactory eventFactory);

}