Boucle infinie ! Spring security / CAS
Salut à tous !
Alors voila, j'ai configuré mon appli afin de la CASifié via spring security et jasig.
Cependant, j'arrive à l'authentification, qui se passe sans problème. Mais après redirection pour validation, mon navigateur boucle entre le serveur CAS et mon appli.
Je soupconne alors mon appli de ne pas voir le ticket, alors que le serveur CAS s'apercoit de sa présence et renvoie vers mon appli.
Comment faire ?
Voici 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 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
| <?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>/lol/*</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> |
et mon 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 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
| <?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="/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="https://127.0.0.1:8888/ce/receptor" />
</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="http://127.0.0.1:8888/ce.html"/>
<property name="sendRenew" value="false"/>
</bean>
<sec:user-service id="userService">
<sec:user name="rod" password="rod" authorities="ROLE_SUPERVISOR,ROLE_USER" />
</sec:user-service>
</beans> |