From 23124ab6f81536cb1a7e242d9caad1aead3fdf14 Mon Sep 17 00:00:00 2001 From: Vinay Mhatre <90505086+SamsterZero@users.noreply.github.com> Date: Wed, 11 Oct 2023 18:26:22 +0530 Subject: [PATCH] To change default redirect Previously after logging in we used to get the desired index page, but the address bar still had the "/login" in the address bar, this code fixes that --- .../com/baeldung/customuserdetails/SecurityConfiguration.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-security-modules/spring-security-web-thymeleaf/src/main/java/com/baeldung/customuserdetails/SecurityConfiguration.java b/spring-security-modules/spring-security-web-thymeleaf/src/main/java/com/baeldung/customuserdetails/SecurityConfiguration.java index cfec910ce9..d438aefcdc 100644 --- a/spring-security-modules/spring-security-web-thymeleaf/src/main/java/com/baeldung/customuserdetails/SecurityConfiguration.java +++ b/spring-security-modules/spring-security-web-thymeleaf/src/main/java/com/baeldung/customuserdetails/SecurityConfiguration.java @@ -28,7 +28,7 @@ public class SecurityConfiguration { .formLogin() .loginPage("/login") .permitAll() - .successForwardUrl("/index") + .defaultSuccessUrl("/index") .and() .logout() .permitAll()