I am using Spring security to authenticate my users. I am trying to log users login and logout activity.
I was able to intercept the login using pointcut expression org.springframework.security.web.authentication.AuthenticationSuccessHandler.onAuthenticationSuccess()
.
But for logout activity it doesn't intercept using the pointcut expression org.springframework.security.web.authentication.logout.HttpStatusReturningLogoutSuccessHandler.onLogoutSuccess()
.
Below is my logLogoutActivity()
:
@After("execution(* org.springframework.security.web.authentication.logout.HttpStatusReturningLogoutSuccessHandler.onLogoutSuccess(..))")
@Transactional
public void logLogoutActivity(JoinPoint joinPoint) throws Throwable {
prepareLogAndSave(HistoryLogCode.LOGGED_OUT.getId(),
HistoryLogCode.LOGGED_OUT.getValue(), "Successfully logged out.");
}
How can I log the logout activity?