2024-04-29 15:01:22 -06:00
|
|
|
package stirling.software.SPDF.config.security;
|
|
|
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
|
|
|
import org.springframework.security.core.Authentication;
|
|
|
|
import org.springframework.security.web.authentication.logout.SimpleUrlLogoutSuccessHandler;
|
|
|
|
|
2024-05-03 20:43:48 +01:00
|
|
|
import jakarta.servlet.ServletException;
|
|
|
|
import jakarta.servlet.http.HttpServletRequest;
|
|
|
|
import jakarta.servlet.http.HttpServletResponse;
|
|
|
|
|
|
|
|
public class CustomLogoutSuccessHandler extends SimpleUrlLogoutSuccessHandler {
|
2024-05-12 19:58:34 +02:00
|
|
|
|
2024-04-29 15:01:22 -06:00
|
|
|
@Override
|
2024-05-03 20:43:48 +01:00
|
|
|
public void onLogoutSuccess(
|
|
|
|
HttpServletRequest request, HttpServletResponse response, Authentication authentication)
|
|
|
|
throws IOException, ServletException {
|
2024-08-16 12:57:37 +02:00
|
|
|
|
|
|
|
if (request.getParameter("userIsDisabled") != null) {
|
|
|
|
getRedirectStrategy()
|
|
|
|
.sendRedirect(request, response, "/login?erroroauth=userIsDisabled");
|
|
|
|
return;
|
2024-04-29 15:01:22 -06:00
|
|
|
}
|
|
|
|
|
2024-08-16 12:57:37 +02:00
|
|
|
getRedirectStrategy().sendRedirect(request, response, "/login?logout=true");
|
2024-04-29 15:01:22 -06:00
|
|
|
}
|
2024-05-03 20:43:48 +01:00
|
|
|
}
|