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") ...

Get Spring Security - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.