July 2018
Intermediate to advanced
268 pages
7h 36m
English
In Chapter 2, Deep Diving into Spring Security (in the Spring Security setup sub-section of the Sample application section), we saw basic authentication, which we configured in our configure method in the Spring Security Configuration class. In this example, we will create a custom login page and change the login mechanism to form-based. Open the SpringSecurityConfig class and change the configure method, as shown in the following code snippet. Then, add the tokenRepository bean that we are going to use to accomplish remember me functionality:
@Overrideprotected void configure(HttpSecurity http) throws Exception { http.csrf().disable(); http.authorizeRequests().anyRequest().hasAnyRole("ADMIN", "USER") .and() ...Read now
Unlock full access