2010-12-05 84 views
1

我在这里解决了我的问题。spring security 2.0.6 AuthenticationProcessingFilter authenticationFailureUrl not working

我已经忘记了以下内容:

<beans:bean id="authenticationProcessingFilterEntryPoint" class="org.springframework.security.ui.webapp.AuthenticationProcessingFilterEntryPoint"> 
    <beans:property name="loginFormUrl" value="/index.jsp" /> 
    <beans:property name="forceHttps" value="false" /> 
</beans:bean> 

正如你可以从上面我有/index.jsp看到,这是它试图去。

另一个问题是以下行

<concurrent-session-control max-sessions="1" exception-if-maximum-exceeded="true"/> 

所以这告诉我抛出和异常。

所以最后 - 一切似乎都按预期工作。


原贴:

由于受到美国,我有以下配置:

<beans:bean id="authenticationProcessingFilter" class="org.springframework.security.ui.webapp.AuthenticationProcessingFilter"> 
    <custom-filter position="AUTHENTICATION_PROCESSING_FILTER" /> 
    <beans:property name="defaultTargetUrl" value="/admin/adminLanding.html"/> 
    <beans:property name="authenticationManager" ref="authenticationManager" /> 
    <beans:property name="authenticationFailureUrl" value="/login.jsp?login_error=1"/> 
    <beans:property name="allowSessionCreation" value="true" /> 
    <beans:property name="targetUrlResolver" ref="roleBasedTargetUrlResolver" /> 
</beans:bean> 

我的期望是,当认证失败或已过期,它将利用设置for authenticationFailureURL。但我得到的是我的日志中的以下错误:

请求的资源(/ecotrak/index.jsp)不可用。

我不明白为什么在给出/login.jsp?login_error=1作为值时查找index.jsp。

任何方向吗?

+0

您在哪些URL中查看日志中提到的错误?它是/ecotrack/index.jsp? – Raghuram 2010-12-06 10:21:04

+0

@Raghuram - 当我等待站点超时 - 大约30分钟左右,我去选择和页面,我的期望是显示登录页面。但是,它似乎想要去index.jsp页面 - 我没有。那么当用户会话超时时,我怎么才能让它进入登录页面呢? – boyd4715 2010-12-07 14:24:52

回答

0

Tienes que reemplazar el throw new AuthenticationServiceException(“Error obteniendo Menu”); ()错误obteniendo菜单));}};}}; response.sendRedirect(request.getContextPath()+“/ login/login.htm?login_error = 1”); return;

Con esas lineas semantendráen tu pagina de error。