- 编写资源文件,Acegi的DaoAuthenticationProvider使用了如下的资源Key
AbstractUserDetailsAuthenticationProvider.badCredentials=自定消息
AbstractUserDetailsAuthenticationProvider.onlySupports=自定消息
AbstractUserDetailsAuthenticationProvider.locked=自定消息 account was locked
AbstractUserDetailsAuthenticationProvider.disabled=自定消息account was disabled
AbstractUserDetailsAuthenticationProvider.expired=自定消息
AbstractUserDetailsAuthenticationProvider.credentialsExpired=自定消息
AbstractUserDetailsAuthenticationProvider.onlySupports=自定消息
AbstractUserDetailsAuthenticationProvider.locked=自定消息 account was locked
AbstractUserDetailsAuthenticationProvider.disabled=自定消息account was disabled
AbstractUserDetailsAuthenticationProvider.expired=自定消息
AbstractUserDetailsAuthenticationProvider.credentialsExpired=自定消息
- 定义资源Bean
<bean id="messageSource"
class="org.springframework.context.support.ResourceBundleMessageSource">
<property name="basename">
<value>资源文件(包名+资源文件名)</value>
</property>
</bean>
class="org.springframework.context.support.ResourceBundleMessageSource">
<property name="basename">
<value>资源文件(包名+资源文件名)</value>
</property>
</bean>
- 将资源Bean注入到DaoAuthenticationProvider
1 <bean id="daoAuthenticationProvider"
2 class="org.acegisecurity.providers.dao.DaoAuthenticationProvider">
3 <property name="userDetailsService">
4 <ref local="inMemoryDaoImpl" />
5 </property>
6 <property name="messageSource">
7 <ref bean="messageSource" />
8 </property>
9 </bean>
2 class="org.acegisecurity.providers.dao.DaoAuthenticationProvider">
3 <property name="userDetailsService">
4 <ref local="inMemoryDaoImpl" />
5 </property>
6 <property name="messageSource">
7 <ref bean="messageSource" />
8 </property>
9 </bean>