JDBC-basedUser Store Example: Difference between revisions
Jump to navigation
Jump to search
(2 intermediate revisions by the same user not shown) | |||
Line 22: | Line 22: | ||
dataSource(dataSource). | dataSource(dataSource). | ||
passwordEncoder(NoOpPasswordEncoder.getInstance()); // apparently it needs a password encoder otherwise it throws | passwordEncoder(NoOpPasswordEncoder.getInstance()); // apparently it needs a password encoder otherwise it throws | ||
// java.lang.IllegalArgumentException: There is no PasswordEncoder mapped for the id | |||
} | } | ||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> |
Latest revision as of 03:12, 26 October 2018
Internal
Example
@Configuration
@EnableWebSecurity
public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
private DataSource dataSource;
public SecurityConfiguration(@Autowired DataSource dataSource) {
this.dataSource = dataSource;
}
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.
jdbcAuthentication().
dataSource(dataSource).
passwordEncoder(NoOpPasswordEncoder.getInstance()); // apparently it needs a password encoder otherwise it throws
// java.lang.IllegalArgumentException: There is no PasswordEncoder mapped for the id
}
}