2017-04-18 83 views
-1

我和春天有个安全的版本2.0.4运行的应用程序,现在我需要更改到4.2.0版本...弹簧安全迁移到4.2.0

我创建登录这个示例页面:

http://facestutorials.icefaces.org/tutorial/spring-security-basic.html

springSecurityLogin.jspx

<?xml version="1.0" encoding="ISO-8859-1" ?> 
<f:view xmlns:f="http://java.sun.com/jsf/core" 
     xmlns:h="http://java.sun.com/jsf/html" 
     xmlns:ice="http://www.icesoft.com/icefaces/component"> 
    <ice:outputDeclaration doctypeRoot="HTML" 
          doctypePublic="-//W3C//DTD HTML 4.01 Transitional//EN" 
          doctypeSystem="http://www.w3.org/TR/html4/loose.dtd"/> 
    <html> 
    <head> 
     <title>Spring Security Login</title> 
    </head> 
    <body> 
    <ice:form partialSubmit="false"> 
     <ice:panelGrid columns="2"> 
      <ice:outputLabel value="User Name" for="j_username"/> 
      <ice:inputText id="j_username" 
          value="#{loginBean.userId}" size="40" 
          maxlength="80"/> 
      <ice:outputLabel value="Password" for="j_password"/> 
      <ice:inputSecret id="j_password" 
          value="#{loginBean.password}" size="40" 
          maxlength="80"/> 
     </ice:panelGrid> 
     <ice:commandButton actionListener="#{loginBean.login}" value="Login"/> 
     <ice:messages style="color: red;"/> 
    </ice:form> 
    </body> 
    </html> 
</f:view> 

登录方法:

public void login(ActionEvent e) throws java.io.IOException { 
    FacesContext.getCurrentInstance().getExternalContext().redirect("/spring-authentication/j_spring_security_check?j_username=" + userId + "&j_password=" + password); 
} 

这是工作......但是,当我的春天安全的版本改为4.2.0我得到了HTTP错误404时尝试登录。

有人知道发生了什么?

+1

有移民指南。 –

+0

迁移指南不适用于冰点... – BrunoTS

+1

这是什么意思? –

回答

0

的问题如下...

弹簧安全允许验证HTTP调用与GET或POST,迁移完成后,默认情况下它是只允许POST调用。

为了解决这个问题,只需要插入您AuthenticationFilter以下行:

UsernamePasswordAuthenticationFilter.setPostOnly(false); 

这解决问题。