/** * Log an authentication process successful completion event. * * @param loginState The login state object. */ public void auditLoginSuccess(LoginState loginState) { String realm = getRealmFromState(loginState); if (eventPublisher.isAuditing(realm, AUTHENTICATION_TOPIC)) { String moduleName = null; String userDN = null; if (loginState != null) { moduleName = loginState.getAuthModuleNames(); userDN = loginState.getUserDN(); } AMAuthenticationAuditEventBuilder builder = eventFactory .authenticationEvent() .transactionId(getTransactionIdValue()) .component(AUTHENTICATION) .eventName(AM_LOGIN_COMPLETED) .result(SUCCESSFUL) .realm(realm) .entry(getAuditEntryDetail(moduleName, loginState)) .trackingIds(getTrackingIds(loginState)) .userId(userDN == null ? "" : userDN) .principal(DNUtils.DNtoName(userDN)); eventPublisher.tryPublish(AUTHENTICATION_TOPIC, builder.toEvent()); } }