文章参考:http://blog.csdn.net/foggysource/article/details/39456963
首先是http的配置,authentication-manager-ref="authenticationManager"指定了默认的authentication-manager
<http auto-config="true" authentication-manager-ref="authenticationManager">
... ...
<logout logout-url="/dynamic/j_spring_security_logout"
logout-success-url="/login.html" invalidate-session="true" />
<custom-filter before="REMEMBER_ME_FILTER" ref="tokenLoginFilter" />
</http>
下面是我的两个authentication-manager配置
<authentication-manager id="authenticationManager">
<authentication-provider user-service-ref="userDetailsServiceImpl">
<!-- 用于密码的认证 -->
<password-encoder ref="userPasswordEncoder" />
</authentication-provider>
</authentication-manager>
<authentication-manager id="equalAuthenticationManager">
<authentication-provider user-service-ref="userDetailsServiceImpl">
<!--用于不需要密码的认证 -->
<password-encoder ref="equalPasswordEncoder" />
</authentication-provider>
</authentication-manager>