mardi 3 mars 2015

Spring security Java config custom AuthenticationProvider order

Using the following code to configure Spring security, I can see in ProviderManager, List AuthenticationProvider has two elements.


MyAuthenticationProvider at index 0 and AnonymousAuthenticationProvider at index 1.


My question is that is there a way to make AnonymousAuthenticationProvider at index 0?



public class MyWebSecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired
private MyAuthenticationProvider myAuthenticationProvider;

@Override
protected void configure(HttpSecurity http) throws Exception {
http.formLogin().authenticationProvider(myAuthenticationProvider);
}
}


I can do http.anonymous().disable() and init and set AnonymousAuthenticationProvider manually but



  1. I am not sure what key for constructor I need to provide.

  2. it is more like a workaround.


Aucun commentaire:

Enregistrer un commentaire