Skip to content

Commit

Permalink
Tcb Logs for successful, failure and locked logins. (#451)
Browse files Browse the repository at this point in the history
* Tcb Logs for successful, failure and locked logins.

* used placeholders instead of concatenation in Log message's
  • Loading branch information
vivek-opsmx authored Dec 11, 2023
1 parent 2756021 commit bd62c0e
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public void onApplicationEvent(AbstractAuthenticationEvent event) {
if (event.getAuthentication().isAuthenticated()
&& event instanceof InteractiveAuthenticationSuccessEvent) {
log.debug("publishEvent InteractiveAuthenticationSuccessEvent");
log.info("Login: User '{}' logged in successfully.",event.getAuthentication().getName());
handleAuthenticationEvent(event, AuditEventType.AUTHENTICATION_SUCCESSFUL_AUDIT);
return;
}
Expand All @@ -60,6 +61,7 @@ public void onApplicationEvent(AbstractAuthenticationEvent event) {
} else if (!event.getAuthentication().isAuthenticated()
&& event instanceof AbstractAuthenticationFailureEvent) {
log.debug("publishEvent AbstractAuthenticationFailureEvent");
log.info("Login : User '{}' login failed due to incorrect credentials.",event.getAuthentication().getName());
auditHandler.publishEvent(AuditEventType.AUTHENTICATION_FAILURE_AUDIT, event);
} else if (event instanceof LogoutSuccessEvent) {
if (event
Expand All @@ -68,10 +70,12 @@ public void onApplicationEvent(AbstractAuthenticationEvent event) {
.getName()
.equals("org.springframework.security.providers.ExpiringUsernameAuthenticationToken")) {
log.debug("publishEvent LogoutSuccessEvent with ExpiringUsernameAuthenticationToken");
log.info("Logout : User '{}' logged out.",event.getAuthentication().getName());
handleAuthenticationEvent(event, AuditEventType.SUCCESSFUL_USER_LOGOUT_AUDIT);
return;
}
log.debug("publishEvent LogoutSuccessEvent");
log.info("Logout : User '{}' logged out manually.",event.getAuthentication().getName());
auditHandler.publishEvent(AuditEventType.SUCCESSFUL_USER_LOGOUT_AUDIT, event);
}

Expand Down

0 comments on commit bd62c0e

Please sign in to comment.