Skip to content

url to specific page with spring security

I have an Spring Boot application.

I need to send emails that contain a direct url to a specific page of the system, something like:

Please, on click on the following link to accept the offer:

The desired behaviour is the following:

  1. The user clicks on the link contained on the email.
  2. The login page appears.
  3. The user logs in and the specific page of the link opens.

But this is not working. When the user clicks the URL, he goes directly to home page, instead of the specific page included in the link.

I have this method in controller:

public String menu(Model model) {   
    return "home";

And this is the Spring Security Configuration class:

            .defaultSuccessUrl("/home", true)

Does anyone know what should I do to make it work properly?

Thanks a million.



Please try to change .defaultSuccessUrl("/home", true) to .defaultSuccessUrl("/home", false)