O'Reilly logo

Spring Security - Third Edition by Peter Mularien, Robert Winch, Mick Knutson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Customizing login

We've seen how Spring Security makes it very easy to get started. Now let's see how we can customize the login experience. In the following code snippet, we demonstrate the usage of some of the more common ways to customize login, but we encourage you to refer to the reference documentation of Spring Security, which includes an Appendix, Additional Reference Material with all of the supported attributes.

Let's take a look at the following steps to customize login:

  1. First, update your SecurityConfig.java file as follows:
        //src/main/java/com/packtpub/springsecurity/configuration/        SecurityConfig.java            http.authorizeRequests()                ...                .formLogin()                   .loginPage("/login/form")                   .loginProcessingUrl("/login") .failureUrl("/login/form?error") ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required