Redirection sur la page de login après Authentification
Bonjour,
S'il vous plait j'ai un souci avec spring security
voici la config de mon fichier applicationContext-security.xml
Code:
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
|
<?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-3.0.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-3.1.xsd">
<!-- Active les annotations de securité -->
<global-method-security secured-annotations="enabled" />
<http use-expressions="true" auto-config="true">
<form-login
login-page="/index.jsp"
default-target-url="/liste-fiches.jsp"
authentication-failure-url="/error.jsp"
always-use-default-target="true"/>
<intercept-url pattern="/index.jsp" access="permitAll()" />
<intercept-url pattern="/vues/index.jsp" access="permitAll()" />
<intercept-url pattern="/css/**" access="permitAll()" />
<intercept-url pattern="/js/**" access="permitAll()" />
<intercept-url pattern="/img/**" access="permitAll()" />
<intercept-url pattern="/resources/**" access="permitAll()" />
<intercept-url pattern="/vues/**" access="hasAnyRole('ROLE_USER', 'ADMIN')"/>
<intercept-url pattern="/**" access="hasAnyRole('ADMIN', 'ROLE_USER')" />
<logout logout-url="/logout" logout-success-url="/logoutSuccess.html" />
</http>
<authentication-manager>
<authentication-provider>
<user-service>
<user name="patricx" password="test" authorities="ROLE_USER" />
</user-service>
</authentication-provider>
</authentication-manager>
</beans:beans> |
et de mon web.xml
Code:
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
|
<?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_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="WebApp_ID" version="2.5">
<display-name>Suivi Collaborateurs</display-name>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<listener>
<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/spring-servlet.xml,
/WEB-INF/applicationContext-security.xml
</param-value>
</context-param>
<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>spring</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>spring</servlet-name>
<url-pattern>*.html</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>*.less</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>*.css</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>*.js</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>*.ico</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>*.txt</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>*.gif</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>*.jpg</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>*.png</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app> |
lorsqu'un utilisateur d'authentifie sur ma page index.jsp
Code:
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
|
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="viewport"
content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<link rel="shortcut icon" href="img/favicon.ico" type="image/vnd.microsoft.icon" />
<link rel="stylesheet/less" type="text/css" href="css/suivicollaborateur.less" />
<script src="js/less.js" type="text/javascript"></script>
<script src="js/jquery-1.9.1.js" type="text/javascript"></script>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Suivi Collaborateur - Bienvenue</title>
</head>
<body>
<header>
<div class="dparties">
<h2 class="logo">
<img src="img/sogeti.png" />
</h2>
<h1 class="titre">Suivi Collaborateurs</h1>
</div>
</header>
<section id="global">
<div id="authentification">
<form action='liste-fiches.html' method="post">
<fieldset>
<legend>Authentification</legend>
<p>
<label for="login"> Login :</label>
<input name="login" placeholder="Login" id="login" type="text"/>
</p>
<p>
<label for="password"> Mot de Passe :</label>
<input name="password" placeholder="********" id="password" type="password"/>
</p>
<p class="entrer">
<input name="entrer" value="Entrer" id="entrer" type="submit"/>
</p>
</fieldset>
</form>
</div>
</section>
</body>
</html> |
il est toujours redirigé sur la même page
Je ne comprend pas pourquoi
Merci de m'aider à y voir un peu plus clair