Java 構成で Spring Security を使用してカスタム認証プロバイダーを定義するにはどうすればよいですか? 自分のデータベースで認証情報をチェックするログインを実行したいと考えています。
33290 次
2 に答える
45
以下は、必要なことを行います(CustomAuthenticationProvider
Spring で管理する必要がある実装です)
@Configuration
@EnableWebMvcSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired
private CustomAuthenticationProvider customAuthenticationProvider;
@Override
protected void configure(HttpSecurity http) throws Exception {
/**
* Do your stuff here
*/
}
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.authenticationProvider(customAuthenticationProvider);
}
}
于 2014-03-24T10:33:00.667 に答える