Sal*_*cis 6 security gwt spring-security
我是春天和春天安全的新手,
我已经理解了如何在xml文件中创建和引用bean,我需要使用spring为我的应用程序提供安全性.
我在web.xml中包含了一个自定义applicationContext-security.xml文件:contextConfigLocation
在这个文件中,我使用截取了url模式
<intercept-url pattern='/**.something' access="IS_AUTHENTICATED_FULLY"/>
Run Code Online (Sandbox Code Playgroud)
内部元素.
我现在已经设置了登录表单,如果页面未经授权,则会显示我的自定义Login.html页面.
现在我面临的问题是:
我试过这个:
<authentication-provider user-service-ref="userDetailsService"/>
<beans:bean id = "userDetailsService" class ="com.somepath.CustomAuthenticationProvider">
<custom-authentication-provider/>
</beans:bean>
Run Code Online (Sandbox Code Playgroud)
其中CustomAuthenticationProvider实现AuthenticationProvider
但代码抛出一个错误:创建名为'_filterChainProxy'的bean时出错....没有UserDetailsService注册
请帮忙
在Spring.xml的web.xml中设置标准Spring Filter之后,使用<http>标记配置的一些默认设置.AuthenticationProcessingFilter作为过滤器链的一部分,为您创建了一个实例.
我的默认设置AuthenticationProcessingFilter是将j_username和j_password作为用户名/密码令牌读取.
要覆盖它,请通过执行以下操作将自定义AuthenticationProcessingFilter替换为默认值:
<bean id=“myAuthFilter” class=“org.springframework.security.ui.webapp.AuthenticationProcessingFilter” >
<security:custom-filter position=“AUTHENTICATION_PROCESSING_FILTER”/><!–-replace the default one-–>
<property name=“usernameParameter” value=“myUsername”/><!-- myUsername is the name of the input tag where user enter their username on the HTML page -->
<property name=“passwordParameter” value=“myPassword” /><!–- myPassword is the name of the input tag where user enter their password on the HTML page -–>
</bean>
Run Code Online (Sandbox Code Playgroud)
有关更多详细信息,另请参阅AuthenticationProcessingFilter的JavaDoc:http: //static.springsource.org/spring-security/site/apidocs/org/springframework/security/ui/webapp/AuthenticationProcessingFilter.html
使用以下代码:
<bean id="myAuthenticationProvider" class="com.something.MyAuthenticationProvider">
<security:custom-authentication-provider />
</bean>
Run Code Online (Sandbox Code Playgroud)
<security:custom-authentication-provider /> 是让Spring知道这是一个自定义提供程序的标记,并且Authentication Manager应该在其提供程序链中使用它.
资料来源:http://static.springsource.org/spring-security/site/docs/2.0.x/reference/appendix-namespace.html#d4e3379
是否com.somepath.CustomAuthenticationProvider实现了UserDetailService接口?
| 归档时间: |
|
| 查看次数: |
15090 次 |
| 最近记录: |