java - Reason why 2nd AuthenticationProvider is called -
i have following websecurityconfig
of spring security in spring boot application.
@enablewebsecurity public class websecurityconfig { @configuration @order(1) public static class form1loginwebsecurityconfigureradapter extends websecurityconfigureradapter { @override protected void configure(httpsecurity http) throws exception { http .antmatcher("/uid/serverinfo.html") .authorizerequests() .antmatchers("/admins/login") .permitall() .antmatchers("/uid/serverinfo.html") .authenticated() .and() .formlogin() .loginprocessingurl("/admins/login") .loginpage("/admins/login") .failureurl("/admins/login?error") .defaultsuccessurl("/uid/serverinfo.html"); } @override public void configure(authenticationmanagerbuilder auth) throws exception { auth.authenticationprovider(authenticationprovider()); } @bean public authenticationprovider authenticationprovider() { return new ldapauthenticationprovider(); } } @configuration @order(2) public static class form2loginwebsecurityconfigureradapter extends websecurityconfigureradapter { @override protected void configure(httpsecurity http) throws exception { http .antmatcher("/admins/**") .authorizerequests() .antmatchers("/admins/login") .permitall() .antmatchers("/admins/**") .authenticated() .and() .formlogin() .loginprocessingurl("/admins/login") .loginpage("/admins/login") .failureurl("/admins/login?error") .defaultsuccessurl("/admins/main"); } @override public void configure(authenticationmanagerbuilder auth) throws exception { auth.authenticationprovider(authenticationprovider()); } @bean public authenticationprovider authenticationprovider() { return new rdbauthenticationprovider(); } } }
if accessing http:localhost:8080/admins/main
, expected result rdbauthenticationprovider.authenticate()
called, ldapauthenticationprovider.authenticate()
called.
does know reason , how fix?
Comments
Post a Comment