Spring安全身份验证管理器-在第一个提供程序之后中断/退出

Spring安全身份验证管理器-在第一个提供程序之后中断/退出,spring,spring-mvc,spring-security,Spring,Spring Mvc,Spring Security,在applicationContext-security.xml中,我将这两个自定义身份验证提供程序添加到身份验证管理器中 <authentication-manager> <authentication-provider ref="daoAuthenticationProvider1"/> <authentication-provider ref="daoAuthenticationProvider2"/> </authentication-manag

在applicationContext-security.xml中,我将这两个自定义身份验证提供程序添加到身份验证管理器中

<authentication-manager>
<authentication-provider ref="daoAuthenticationProvider1"/>
<authentication-provider ref="daoAuthenticationProvider2"/>
</authentication-manager>

如果我想在某个条件(例如无效的_密码)后退出第一个提供程序,并且不想转到下一个提供程序,需要抛出什么异常


我知道这不是Spring的预期行为,它没有任何意义,但这有可能吗?

以编程方式进行


将provider2注入1。从安全配置中删除provider2

我解决了它。通过抛出AccountStatusException,它将中断剩余身份验证提供程序的轮询。

这是一种方法。但是,如果我有多个身份验证提供程序,那么我必须将所有身份验证提供程序都注入到第一个提供程序中,这非常麻烦。@WiltsC在输入输入输入密码时,需要体验什么行为?+1。我想这是设计师们想要的。例如,见