IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Sécurité Java Discussion :

Redirection après connection


Sujet :

Sécurité Java

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre averti
    Profil pro
    Inscrit en
    Février 2010
    Messages
    53
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2010
    Messages : 53
    Par défaut Redirection après connection
    Bonjour à tous,

    J'ai un petit problème. Voila, j'ai choisi de CASifier une application via spring security.

    Lorsque je me connecte sur l'application, et que je n'ai pas de ticket, il me redirige bien vers le serveur CAS d'authentification. Je m'authentifie donc, et la conenction est réussie. Pourtant, je reste bloqué sur le message "connection réussie" du serveur CAS, et je ne suis jamais redirigé vers mon application. Si je rentre l'URL à la main, il me renvoie vers ce message d'authentification réussie.

    Comment faire pour rediriger automatiquement après authentification vers mon appli ?

    mon web.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
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    <?xml version="1.0" encoding="utf-8"?>
    <web-app version="2.5" 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">
     
    	<listener>
    		<listener-class>com.novedia.ce.gwt.server.ClassPathContextListener</listener-class>
    	</listener>
     
    	<context-param>
    		<param-name>contextConfigLocation</param-name>
    		<param-value>
    			/WEB-INF/spring/applicationContext-security.xml
    			classpath*:META-INF/spring/applicationContext*.xml
    		</param-value>
    	</context-param>
     
    <!--	<context-param>-->
    <!--	  <param-name>serverName</param-name>-->
    <!--	  <param-value>127.0.0.1:8888</param-value>-->
    <!--	</context-param>-->
     
    	<context-param>
            <param-name>webAppRootKey</param-name>
            <param-value>cas.root</param-value>
        </context-param>
     
    	 <!--
          - Loads the root application context of this web app at startup.
          - The application context is then available via
          - WebApplicationContextUtils.getWebApplicationContext(servletContext).
        -->
    <!--    <listener>-->
    <!--        <listener-class>org.jasig.cas.client.session.SingleSignOutHttpSessionListener</listener-class>-->
    <!--    </listener>-->
     
    	<listener>
    		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    	</listener>
     
     
     
        <filter>
            <filter-name>springSecurityFilterChain</filter-name>
            <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
        </filter>
     
        <filter>
           <filter-name>CAS Single Sign Out Filter</filter-name>
           <filter-class>org.jasig.cas.client.session.SingleSignOutFilter</filter-class>
        </filter>
     
    <!--	<servlet>-->
    <!--		<servlet-name>rpc</servlet-name>-->
    <!--		<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>-->
    <!--		<init-param>-->
    <!--			<param-name>contextConfigLocation</param-name>-->
    <!--			<param-value>/WEB-INF/spring/rpc-config.xml</param-value>-->
    <!--		</init-param>-->
    <!--	</servlet>-->
    <!---->
    <!--	<servlet-mapping>-->
    <!--		<servlet-name>rpc</servlet-name>-->
    <!--		<url-pattern>*.rpc</url-pattern>-->
    <!--	</servlet-mapping>-->
     
    	<!-- CAS Filter -->
     
        <filter-mapping>
           <filter-name>CAS Single Sign Out Filter</filter-name>
           <url-pattern>/*</url-pattern>
        </filter-mapping>
     
        <filter-mapping>
          <filter-name>springSecurityFilterChain</filter-name>
          <url-pattern>/*</url-pattern>
        </filter-mapping>
     
     
     
     
    <!--	<filter>-->
    <!--		<filter-name>CAS Authentication Filter</filter-name>-->
    <!--	  	<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>-->
    <!--		<init-param>-->
    <!--			<param-name>targetBeanName</param-name>-->
    <!--			<param-value>authenticationFilter</param-value>-->
    <!--		</init-param>-->
    <!--    </filter>-->
    <!--    -->
    <!--    <filter-mapping>-->
    <!--		<filter-name>CAS Authentication Filter</filter-name>-->
    <!--		<url-pattern>/*</url-pattern>-->
    <!--	</filter-mapping>-->
     
     
     
        
    <!---->
    <!---->
    <!--	-->
    <!--	<filter>-->
    <!--	  <filter-name>CAS Single Sign Out Filter</filter-name>-->
    <!--	  <filter-class>org.jasig.cas.client.session.SingleSignOutFilter</filter-class>-->
    <!--	</filter>-->
    <!--	-->
    <!--	<filter>-->
    <!--	  <filter-name>CAS Authentication Filter</filter-name>-->
    <!--	  <filter-class>org.jasig.cas.client.authentication.AuthenticationFilter</filter-class>-->
    <!--	  <init-param>-->
    <!--	    <param-name>casServerLoginUrl</param-name>-->
    <!--	    <param-value>https://extranet.smart-up.net/cas/login</param-value>-->
    <!--	  </init-param>-->
    <!--	  <init-param>-->
    <!--	    <param-name>renew</param-name>-->
    <!--	    <param-value>false</param-value>-->
    <!--	  </init-param>-->
    <!--	  <init-param>-->
    <!--	    <param-name>gateway</param-name>-->
    <!--	    <param-value>false</param-value>-->
    <!--	  </init-param>-->
    <!---->
    <!--	</filter>-->
    <!--	-->
    <!--	<filter>-->
    <!--	  <filter-name>CAS Validation Filter</filter-name>-->
    <!--	  <filter-class>org.jasig.cas.client.validation.Cas10TicketValidationFilter</filter-class>-->
    <!--	  <init-param>-->
    <!--	    <param-name>casServerUrlPrefix</param-name>-->
    <!--	    <param-value>https://extranet.smart-up.net/cas/</param-value>-->
    <!--	  </init-param>-->
    <!--	</filter>-->
    <!--	-->
    <!--	<filter>-->
    <!--	  <filter-name>CASWrapper</filter-name>-->
    <!--	  <filter-class>-->
    <!--	    org.jasig.cas.client.util.HttpServletRequestWrapperFilter-->
    <!--	  </filter-class>-->
    <!--	</filter>-->
    <!---->
    <!--	<filter-mapping>-->
    <!--	  <filter-name>CAS Single Sign Out Filter</filter-name>-->
    <!--	  <url-pattern>/*</url-pattern>-->
    <!--	</filter-mapping>-->
    <!---->
    <!-- CAS Wrapper Filter Mapping -->
    <!---->
    <!--	<filter-mapping>-->
    <!--		<filter-name>CAS Authentication Filter</filter-name>-->
    <!--		<url-pattern>/*</url-pattern>-->
    <!--	</filter-mapping>-->
    <!--	-->
    <!--	<filter-mapping>-->
    <!--		<filter-name>CAS Validation Filter</filter-name>-->
    <!--		<url-pattern>/*</url-pattern>-->
    <!--	</filter-mapping>-->
    <!--	-->
    <!--	<filter-mapping>-->
    <!--	  <filter-name>CASWrapper</filter-name>-->
    <!--	  <url-pattern>/*</url-pattern>-->
    <!--	</filter-mapping>-->
     
    	<welcome-file-list>
    		<welcome-file>ce.html</welcome-file>
    	</welcome-file-list>
     
    </web-app>
    mon applicationContext-security

    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
    <?xml version="1.0" encoding="UTF-8"?>
     
    <beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:sec="http://www.springframework.org/schema/security"
        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.0.xsd">
     
        <sec:http entry-point-ref="casProcessingFilterEntryPoint">
            <sec:intercept-url pattern="/secure/extreme/**" access="ROLE_SUPERVISOR" requires-channel="https"/>
            <sec:intercept-url pattern="/**" access="ROLE_USER" />
            <sec:logout logout-success-url="/cas-logout.jsp"/>
            <sec:custom-filter ref="casAuthenticationFilter" after="CAS_FILTER"/>
        </sec:http>
     
        <sec:authentication-manager alias="authenticationManager">
            <sec:authentication-provider ref="casAuthenticationProvider"/>
        </sec:authentication-manager>
     
        <bean id="casAuthenticationFilter" class="org.springframework.security.cas.web.CasAuthenticationFilter">
            <property name="authenticationManager" ref="authenticationManager"/>
            <property name="authenticationFailureHandler">
                <bean class="org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler">
                    <property name="defaultFailureUrl" value="/casfailed.jsp"/>
                </bean>
            </property>
            <property name="authenticationSuccessHandler">
                <bean class="org.springframework.security.web.authentication.SimpleUrlAuthenticationSuccessHandler">
                    <property name="defaultTargetUrl" value="/"/>
                </bean>
            </property>
            <property name="proxyGrantingTicketStorage" ref="proxyGrantingTicketStorage" />
            <property name="proxyReceptorUrl" value="/secure/receptor" />
        </bean>
     
        <bean id="casProcessingFilterEntryPoint" class="org.springframework.security.cas.web.CasAuthenticationEntryPoint">
            <property name="loginUrl" value="https://extranet.smart-up.net/cas/login"/>
            <property name="serviceProperties" ref="serviceProperties"/>
        </bean>
     
        <bean id="casAuthenticationProvider" class="org.springframework.security.cas.authentication.CasAuthenticationProvider">
            <property name="userDetailsService" ref="userService"/>
            <property name="serviceProperties" ref="serviceProperties" />
            <property name="ticketValidator">
                <bean class="org.jasig.cas.client.validation.Cas20ServiceTicketValidator">
                    <constructor-arg index="0" value="https://extranet.smart-up.net/cas/" />
                    <property name="proxyGrantingTicketStorage" ref="proxyGrantingTicketStorage" />
                    <property name="proxyCallbackUrl" value="127.0.0.1:8888" />
                </bean>
            </property>
            <property name="key" value="an_id_for_this_auth_provider_only"/>
        </bean>
     
        <bean id="proxyGrantingTicketStorage" class="org.jasig.cas.client.proxy.ProxyGrantingTicketStorageImpl" />
     
        <bean id="serviceProperties" class="org.springframework.security.cas.ServiceProperties">
            <property name="service" value="127.0.0.1:8888"/>
            <property name="sendRenew" value="false"/>
        </bean>
     
        <sec:user-service id="userService">
            <sec:user name="rod" password="rod" authorities="ROLE_SUPERVISOR,ROLE_USER" />
            <sec:user name="dianne" password="dianne" authorities="ROLE_USER" />
            <sec:user name="scott" password="scott" authorities="ROLE_USER" />
        </sec:user-service>
    </beans>

  2. #2
    Membre averti
    Profil pro
    Inscrit en
    Février 2010
    Messages
    53
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2010
    Messages : 53
    Par défaut
    Finalement,j 'ai trouvé. Cependant, maintenant, je reçois l'erreur suivante :

    Redirection de page incorrecte

    Firefox a détecté que le serveur redirige la demande pour cette adresse d'une manière qui n'aboutira pas.


    * La cause de ce problème peut être la désactivation ou le refus
    des cookie


    Comment faire ?

  3. #3
    Membre à l'essai
    Inscrit en
    Juillet 2010
    Messages
    6
    Détails du profil
    Informations forums :
    Inscription : Juillet 2010
    Messages : 6
    Par défaut
    Bonjour, avez vous trouver la réponse à votre question?

Discussions similaires

  1. redirection aprés la créaton d'un cookie
    Par vbcasimir dans le forum Web
    Réponses: 3
    Dernier message: 14/05/2006, 20h28
  2. Redirection après formulaire...
    Par kobe dans le forum Général JavaScript
    Réponses: 2
    Dernier message: 28/03/2006, 09h53
  3. [MySQL] redirection après requête
    Par djinko dans le forum PHP & Base de données
    Réponses: 9
    Dernier message: 08/03/2006, 11h13
  4. Probleme de redirection apres fermeture de session
    Par soufienne dans le forum ASP
    Réponses: 3
    Dernier message: 08/04/2004, 10h52
  5. [Strategie]Redirection après un formulaire
    Par kyser91 dans le forum Servlets/JSP
    Réponses: 7
    Dernier message: 19/03/2004, 15h15

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo