July 2018
Intermediate to advanced
268 pages
7h 36m
English
We will now create the all-important Spring Security configuration class and make sure that the default filter chain for Spring Security is set up to secure all the resources:
@EnableWebSecuritypublic class SpringSecurityConfig extends WebSecurityConfigurerAdapter { @Autowired private DataSource dataSource; @Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { auth.jdbcAuthentication().dataSource(dataSource) .usersByUsernameQuery("select username, password, enabled" + " from users where username = ?") .authoritiesByUsernameQuery("select username, authority " + "from authorities where username = ?") .passwordEncoder(new BCryptPasswordEncoder()); } @Override protected ...Read now
Unlock full access