2016-07-26 109 views
0

我在Spring Security的項目中遇到了一些麻煩。我用自動登錄表單完成了初始配置,並且工作正常。但是,當我登錄並嘗試執行一些操作後,我意識到我的commandButtons不再工作。當我點擊時,沒有任何反應。在這種情況下,我需要做任何配置嗎?春季安全攔截commandButton動作

這裏是我的applicationContext.xml:

<?xml version="1.0" encoding="UTF-8"?> 
<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.1.xsd"> 

    <http pattern="/javax.faces.resource/**" security="none" /> 
    <http pattern="/login.xhtml" security="none" /> 
    <http pattern="/404.xhtml" security="none" /> 
    <http pattern="/error.xhtml" security="none" /> 
    <http pattern="/access-denied.xhtml" security="none" /> 

    <http auto-config="true"> 
     <intercept-url pattern="/**" access="hasAnyRole('ROLE_ADMINISTRADORES')" /> 
    </http> 

    <authentication-manager> 
     <authentication-provider> 
      <user-service> 
       <user name="joao" password="123" authorities="ROLE_VENDEDORES" /> 
       <user name="jean" password="123" authorities="ROLE_ADMINISTRADORES" /> 
      </user-service> 
     </authentication-provider> 
    </authentication-manager> 

</beans:beans> 

謝謝大家!

+0

是它!非常感謝Slava ..你救了我!關閉CSRF有什麼問題嗎? –

+0

我已經發布它作爲答案。另外我添加了一個鏈接到Spring Security文檔,您可以在其中找到關於此主題的更多信息。 –

回答