Announcement Announcement Module
Collapse
No announcement yet.
no redirection after login Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • no redirection after login

    Hi,

    Please i'm facing an issue with spring security

    Here is my applicationContext-security.xml file

    Code:
    <?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>
    and my web.xml file
    Code:
    <?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>
    when a user inserts his login and password on my index.jsp file
    Code:
    <%@ 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>
    he is redirected on the same page
    I can't get why

    Thanks for giving me a help

  • #2
    This appears to be a duplicate of http://forum.springsource.org/showth...on-After-login

    Comment

    Working...
    X