Bonjour à tous,
je dispose d'une application web et aurais aimé mettre en place Spring security 3 pour sécuriser l'accès à certaines pages.
Mon application utilise Spring MVC 3 pour son implémentation simple de REST.
Lorsque j'essaie d'accéder à une URL sécurisée, je suis bien redirigé vers ma page de Login.
Lorsque j'essaie de m'authentifier, mon authenticationProvider n'est pas appelé.
D'après le message d'erreur, on dirait que c'est mon filtre pour REST qui a l'avantage.
Voici mon message d'erreur :
Voici ma configuration web.xml
Code : Sélectionner tout - Visualiser dans une fenêtre à part PageNotFound - No mapping found for HTTP request with URI [/monappli/j_spring_security_check] in DispatcherServlet with name 'spring'
J'ai mon fichier de Conf Spring webappContext.xml
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86 <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_4.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_4.xsd" id="Chefcuisto" version="2.4"> <context-param> <param-name>log4jConfigLocation</param-name> <param-value>classpath:log4j.xml</param-value> </context-param> <context-param> <param-name>log4jRefreshInterval</param-name> <param-value>10000</param-value> </context-param> <context-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/spring/webappContext.xml</param-value> </context-param> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <listener> <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class> </listener> <filter> <filter-name>encoding-filter</filter-name> <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class> <init-param> <param-name>encoding</param-name> <param-value>UTF-8</param-value> </init-param> </filter> <filter-mapping> <filter-name>encoding-filter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <servlet> <servlet-name>spring</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <init-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/spring/webappContext.xml</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>spring</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>/static/*</url-pattern> </servlet-mapping> <filter> <filter-name>httpMethodFilter</filter-name> <filter-class>org.springframework.web.filter.HiddenHttpMethodFilter</filter-class> </filter> <filter-mapping> <filter-name>httpMethodFilter</filter-name> <servlet-name>spring</servlet-name> </filter-mapping> <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> <session-config> <session-timeout>30</session-timeout> </session-config> <welcome-file-list> <welcome-file>redirect.jsp</welcome-file> </welcome-file-list> </web-app>
Est-ce que quelqu'un a déjà rencontré mon souci, car j'ai beau chercher sur le net je ne trouve rien...
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44 <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:security="http://www.springframework.org/schema/security" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd" http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.0.xsd"> <context:component-scan base-package="fr.chefcuisto.web" /> <mvc:annotation-driven /> <bean id="validator" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean"></bean> <security:global-method-security pre-post-annotations="enabled" /> <security:http auto-config="true"> <security:intercept-url pattern="/static/**" filters="none" /> <!-- <security:intercept-url pattern="/mon-compte/connexion" filters="none" /> <security:intercept-url pattern="/mon-compte/inscription" filters="none" /> --> <security:intercept-url pattern="/admin/*" access="ROLE_ADMIN" /> <security:intercept-url pattern="/*" filters="none" /> <security:form-login login-page="/mon-compte/connexion" default-target-url="/" login-processing-url="/j_spring_security_check" /> <security:logout logout-url="/j_spring_security_logout" logout-success-url="/" /> <security:session-management invalid-session-url="/mon-compte/connexion" /> </security:http> <security:authentication-manager> <security:authentication-provider ref="authProvider" /> </security:authentication-manager> <bean id="authProvider" class="fr.monappli.web.security.CustomAuthenticationProvider" /> </beans>
D'avance merci pour votre aide !
Partager