上QQ阅读APP看书,第一时间看更新
Configuring the CalendarUserAuthenticationProvider object
Let's perform the following steps to configure CalendarUserAuthenticationProvider:
- Update the SecurityConfig.java file to refer to our newly created CalendarUserAuthenticationProvider object, and remove the reference to CalendarUserDetailsService, as shown in the following code snippet:
//src/main/java/com/packtpub/springsecurity/configuration/
SecurityConfig.java
@Autowired CalendarUserAuthenticationProvider cuap;
@Override
public void configure(AuthenticationManagerBuilder auth)
throws Exception {
auth.authenticationProvider(cuap);
}
- Restart the application and ensure everything is still working. As a user, we do not notice anything different. However, as a developer, we know that CalendarUserDetails is no longer required; we are still able to display the current user's first and last names, and Spring Security is still able to leverage CalendarUser for authentication.
Your code should now look like chapter03.05-calendar.