【发布时间】:2012-07-19 19:56:44
【问题描述】:
Spring 文档说ProviderManager 是AuthenticationManager 的默认实现,但ProviderManager 的实例是由安全命名空间自动创建和连接的吗?
也就是说,这样的配置会不会自动创建ProviderManager的实例:
<authentication-manager>
<authentication-provider>
<password-encoder hash="md5"/>
<jdbc-user-service data-source-ref="dataSource"/>
</authentication-provider>
</authentication-manager>
否则,我需要做什么(或声明)?
假设我想插入自己的 AuthenticationManager 实现,我将如何使用命名空间进行配置?
我还想指定应该在ProviderManager 中注册哪个AuthenticationProvider。我找到了以下一段配置代码:
<bean id="authenticationManager"
class="org.springframework.security.authentication.ProviderManager">
<property name="providers">
<list>
<ref local="daoAuthenticationProvider"/>
<ref local="anonymousAuthenticationProvider"/>
</list>
</property>
</bean>
但这足够了吗?声明AuthenticationProvider列表的正确方法是什么?关于这个问题的文档不是很清楚和完整。
【问题讨论】:
-
我已经发布了我认为对我的问题的正确答案。如有必要,我会给专家一些时间来提供他们的意见/反馈。
标签: java configuration spring-security