代码之家  ›  专栏  ›  技术社区  ›  at.

使用spring security验证失败后重定向回原始页

  •  8
  • at.  · 技术社区  · 14 年前

        <form-login login-page="/login" authentication-failure-url="/login?error=credentials" default-target-url="/account" login-processing-url="/security_check"/>
    

    那我该怎么做呢?

    1 回复  |  直到 14 年前
        1
  •  2
  •   Aaron Saunders    14 年前
     <!-- redirect url for failure of authentication -->
     <bean id="simpleUrlAuthenticationFailureHandler" class="org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler">
            <constructor-arg value="/login.jsp?error=1"></constructor-arg>
    </bean>
    

    我建议您从上下文访问对象并重置url,或者编写您自己的自定义处理程序,这些处理程序可能会执行特定于您所在页面的操作

    http://static.springsource.org/spring-security/site/apidocs/org/springframework/security/web/authentication/SimpleUrlAuthenticationFailureHandler.html