1
我决定使用自定义的AutenticationManager进行我的单元测试。以下是我在我的测试方面的文件已经把迄今:自定义身份验证管理器
<beans:bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<beans:property name="location" value="classpath:ldap.properties"/>
</beans:bean>
<global-method-security secured-annotations="enabled" pre-post-annotations="enabled" >
<expression-handler ref="expressionHandler"/>
</global-method-security>
<authentication-manager alias="authenticationManager">
<authentication-provider ref="preAuthProvider">
<user-service>
<user name="department1000" password="password" authorities="ROLE_1000" />
<user name="alldepartments" password="password2" authorities="ROLE_ALL_DEPT_ACCESS" />
<user name="esssaa" password="password3" authorities="ROLE_STUDENT" />
<beans:bean id="permissionEvaluator" class="fi.utu.security.PermissionEvaluatorImpl"/>
这会导致 配置问题:与“裁判”使用属性
我需要定制的UserDetailsService一些自定义的类时,认证供应商元素不能有子元素,或者我可以以某种方式使之与弹簧自动装配bean的工作班?
这是很好的。但是,在使用user-service-tag时,是否需要对UserDetailsSservice进行任何引用? – mjgirl
不确定你的意思。 'user-service'定义了一个嵌入式用户列表,通常用于测试。它没有'ref'属性。另外,请查看[身份验证提供程序的命名空间附录文档](http://docs.spring.io/spring-security/site/docs/3.1.x/reference/springsecurity-single.html#nsa-authentication -provider)。 –
当我离开参考时,出现错误,说找不到autencation提供者。 – mjgirl