mercredi 11 mars 2015

Spring Security - All JQuery Ajax post requests return 404

All my $.ajax, both POST and GET were working fine, but as soon as I integrated Spring security 3.2.6 into my project the POST ajax requests stopped working without loggin any issues.


spring-security.xml



<beans:beans xmlns:beans="http://ift.tt/GArMu6"
xmlns:xsi="http://ift.tt/ra1lAU"
xmlns="http://ift.tt/1c8inpe"
xsi:schemaLocation="http://ift.tt/GArMu6
http://ift.tt/1jdM0fG
http://ift.tt/1c8inpe
http://ift.tt/1epvZ6L">

<!--Permit all Web resources to bypass proxy-->
<http pattern="/js/**" security="none"/>
<http pattern="/css/**" security="none"/>
<http pattern="/fonts/**" security="none"/>
<http pattern="/images/**" security="none"/>

<http auto-config="true" use-expressions="true" >

<intercept-url pattern="/login" access="isAnonymous()"/>

<intercept-url pattern="/workflow**" access="hasRole('ROLE_WORKFLOW_ADMIN')"/>
<intercept-url pattern="/**" access="hasAnyRole('ROLE_ADMIN','ROLE_WORKFLOW_ADMIN','ROLE_DMS_ADMIN')"/>

<access-denied-handler error-page="/403"/>

<form-login
login-page="/login"
default-target-url="/dashboard"
authentication-failure-url="/login?error"
username-parameter="username"
password-parameter="password"/>

<logout invalidate-session="true" logout-success-url="/login?logout"/>

<csrf/>
</http>

<!-- Select users and user_roles from database -->
<authentication-manager>
<authentication-provider ref="daoAuthenticationProvider"/>
</authentication-manager>

<beans:bean id="daoAuthenticationProvider"
class="org.springframework.security.authentication.dao.DaoAuthenticationProvider">
<beans:property name="userDetailsService" ref="authService"/>
</beans:bean>


</beans:beans>


Web.xml



<web-app xmlns:xsi="http://ift.tt/ra1lAU"
xmlns="http://ift.tt/nSRXKP"
xsi:schemaLocation="http://ift.tt/nSRXKP
http://ift.tt/LU8AHS"
version="2.5">

<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

<servlet>
<servlet-name>mvc-dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
<servlet-name>mvc-dispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>

<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/mvc-dispatcher-servlet.xml
/WEB-INF/spring-security.xml
</param-value>
</context-param>

<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

<error-page>
<exception-type>java.lang.Throwable</exception-type>
<location>/error</location>
</error-page>
<error-page>
<error-code>500</error-code>
<location>/error</location>
</error-page>

</web-app>


Edit




The URL I am trying to access is



http://localhost:8080/ADMIN/workflow/sample-ajax



Could it be something to with spring security ?


Aucun commentaire:

Enregistrer un commentaire