Commit c51bc65a by linxu

fix(logout): improve REST logout success handler and update gitignore

parent 8e04c9f4
......@@ -9,6 +9,7 @@
.settings
.springBeans
.sts4-cache
.DS_Store
### IntelliJ IDEA ###
.idea
......
package com.keymobile.sso.conf;
import com.keymobile.sso.logging.LogConstants;
import com.keymobile.sso.logging.LogManager;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
......@@ -16,6 +18,10 @@ public class RESTLogoutSuccessHandler implements LogoutSuccessHandler {
@Override
public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException, ServletException {
if (authentication != null && authentication.getName() != null) {
LogManager.logInfo(LogConstants.CTX_AUDIT, "User logged out: " + authentication.getName());
}
request.getSession().invalidate();
response.setStatus(HttpStatus.OK.value());
response.getWriter().flush();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment