mirror of
https://github.com/Stirling-Tools/Stirling-PDF.git
synced 2025-05-24 19:02:01 +00:00
This commit is contained in:
parent
7ccb4d59b0
commit
8ea179e3e6
@ -45,7 +45,15 @@ public class CustomAuthenticationSuccessHandler
|
|||||||
? (SavedRequest) session.getAttribute("SPRING_SECURITY_SAVED_REQUEST")
|
? (SavedRequest) session.getAttribute("SPRING_SECURITY_SAVED_REQUEST")
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
if (savedRequest != null
|
// Check for the stored previous page URL
|
||||||
|
String previousPageUrl = (session != null) ? (String) session.getAttribute("PREVIOUS_PAGE_URL") : null;
|
||||||
|
|
||||||
|
if (previousPageUrl != null) {
|
||||||
|
// Redirect to the stored previous page URL
|
||||||
|
getRedirectStrategy().sendRedirect(request, response, previousPageUrl);
|
||||||
|
// Remove the stored previous page URL from the session
|
||||||
|
session.removeAttribute("PREVIOUS_PAGE_URL");
|
||||||
|
} else if (savedRequest != null
|
||||||
&& !RequestUriUtils.isStaticResource(
|
&& !RequestUriUtils.isStaticResource(
|
||||||
request.getContextPath(), savedRequest.getRedirectUrl())) {
|
request.getContextPath(), savedRequest.getRedirectUrl())) {
|
||||||
// Redirect to the original destination
|
// Redirect to the original destination
|
||||||
|
@ -20,6 +20,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
|||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import jakarta.servlet.http.HttpSession;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import stirling.software.SPDF.config.security.session.SessionPersistentRegistry;
|
import stirling.software.SPDF.config.security.session.SessionPersistentRegistry;
|
||||||
import stirling.software.SPDF.model.*;
|
import stirling.software.SPDF.model.*;
|
||||||
@ -49,6 +50,13 @@ public class AccountWebController {
|
|||||||
return "redirect:/";
|
return "redirect:/";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Store the previous page URL in the session before redirecting to the login page
|
||||||
|
HttpSession session = request.getSession();
|
||||||
|
String referer = request.getHeader("Referer");
|
||||||
|
if (referer != null && !referer.contains("/login")) {
|
||||||
|
session.setAttribute("PREVIOUS_PAGE_URL", referer);
|
||||||
|
}
|
||||||
|
|
||||||
Map<String, String> providerList = new HashMap<>();
|
Map<String, String> providerList = new HashMap<>();
|
||||||
|
|
||||||
OAUTH2 oauth = applicationProperties.getSecurity().getOAUTH2();
|
OAUTH2 oauth = applicationProperties.getSecurity().getOAUTH2();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user