0
我試圖配置彈簧Web應用程序PreAuthenticationFilter。我下面這個official guide,看着那部分春季安全預認證配置
18.2.1請求標題認證(SiteMinder的)
這裏是我的security.xml文件,它概述我的豆子和配置:
<beans:beans xmlns="http://www.springframework.org/schema/security"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-4.0.xsd"
xmlns:context="http://www.springframework.org/schema/context">
<beans:bean id="myFilter" class="com.MyFilter">
<beans:property name="authenticationManager" ref="authenticationManager" />
</beans:bean>
<beans:bean id="preauthAuthProvider" class="org.springframework.security.web.authentication.preauth.PreAuthenticatedAuthenticationProvider">
<beans:property name="preAuthenticatedUserDetailsService">
<beans:bean id="userDetailsServiceWrapper" class="org.springframework.security.core.userdetails.UserDetailsByNameServiceWrapper">
<beans:property name="userDetailsService" ref="userDetailsService"/>
</beans:bean>
</beans:property>
</beans:bean>
<authentication-manager alias="authenticationManager">
<authentication-provider ref="preauthAuthProvider" />
</authentication-manager>
<http auto-config="true" use-expressions="true" pattern="/**" >
<intercept-url pattern="/main/data" access="hasAnyRole('ROLE_ADMINISTRATORS')" requires-channel="https" />
<intercept-url pattern="/**" access="isAuthenticated()" requires-channel="any" />
<http-basic />
</http>
基本上,我是從導向chaning的唯一的事就是我的filterId和類。其他一切都是一樣的。
我得到的錯誤是這樣的:
Cannot resolve reference to bean 'userDetailsService' while setting bean property 'userDetailsService'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'userDetailsService' is defined
缺少什麼我在這裏?該類已經在我的項目中的Spring Jar中,並且可以導入到任何類中。
嘆息,你是正確的。我錯過了表示必須實現自己的userdetailservice的小腳印。在grails 3插件中,它做同樣的事情,你不這樣做,因此在那裏引起了一個小小的差異。 – angryip