spring - Difference between AuthenticationManagerBuilder and HttpSecurity.authenticationProvider -
to provide custom authentication provider in spring boot, need both of following? , difference?
httpsecurity.authenticationprovider(...)
@configuration @enablewebsecurity public class securityconfig extends websecurityconfigureradapter{ @autowired private myauthenticationprovider myauthenticationprovider; @autowired @override protected void configure(authenticationmanagerbuilder auth) throws exception { auth.authenticationprovider(myauthenticationprovider); } // --------------- or/and ? ---------------- @override protected void configure(httpsecurity http) throws exception { http .authenticationprovider(myauthenticationprovider) // ... } }
you need use 1 of 2 options. internally, http.authenticationprovider making call authenticationmanagerbuilder.authenticationprovider.
Comments
Post a Comment