如何让Spring对我使用的数据库进行身份验证?
我在Spring boot支持的API中有以下安全配置如何让Spring对我使用的数据库进行身份验证?,spring,spring-boot,spring-security,Spring,Spring Boot,Spring Security,我在Spring boot支持的API中有以下安全配置 @Configuration @EnableGlobalMethodSecurity(prePostEnabled = true) @EnableWebSecurity public class SecurityConfiguration extends WebSecurityConfigurerAdapter { @Override protected void configure(HttpSecurity http) t
@Configuration
@EnableGlobalMethodSecurity(prePostEnabled = true)
@EnableWebSecurity
public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.httpBasic().and().authorizeRequests()
.antMatchers("/", "/helloWorld").permitAll()
.anyRequest().authenticated();
http.csrf().disable();
}
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
auth.inMemoryAuthentication()
.withUser("user").password("password").roles("USER")
.and().withUser("tester").password("password").roles("NOROLE");
}
}
现在,这很好-它让我开始运行,测试我的资源,等等
但目前,我真的不知道如何适应我存储在数据库中的用户。我理解我需要遵循的逻辑:
非常感谢您的帮助。谢谢。不要问阅读如何解释如何使用数据库的问题?基本上,SpringSecurity可以满足您的所有需求……这正是我想要的。考虑到这个网站的用途,不必抱怨我问了一个问题。谢谢