<?xml version="1.0" encoding="UTF-8"?>
<!--
  - Tutorial web application
  -
  -->

<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee https://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
	<display-name>Spring Security CAS Demo Application</display-name>

	<!--
	  - Location of the XML file that defines the root application context
	  - Applied by ContextLoaderListener.
	  -->
	<context-param>
		<param-name>contextConfigLocation</param-name>
		<param-value>
			/WEB-INF/applicationContext-security.xml
		</param-value>
	</context-param>

	<context-param>
		<param-name>webAppRootKey</param-name>
		<param-value>cas.root</param-value>
	</context-param>

	<!--
		Include the character encoding Filter as per JASIG recommenation when doing Single Sign Out
		https://wiki.jasig.org/display/CASC/Configuring+Single+Sign+Out
	-->
	<filter>
		<filter-name>characterEncodingFilter</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>
		<filter-name>springSecurityFilterChain</filter-name>
		<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
	</filter>

	<filter-mapping>
		<filter-name>characterEncodingFilter</filter-name>
		<url-pattern>/*</url-pattern>
	</filter-mapping>
	<filter-mapping>
		<filter-name>springSecurityFilterChain</filter-name>
		<url-pattern>/*</url-pattern>
	</filter-mapping>

	<!--
		Included to support Single Logout. Note that the SingleSignOutFilter is included in the
		springSecurityFilterChain. However, it could also be placed as the first filter-mapping
		in the web.xml
	-->
	<listener>
		<listener-class>org.jasig.cas.client.session.SingleSignOutHttpSessionListener</listener-class>
	</listener>

	<!--
	  - 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.springframework.web.context.ContextLoaderListener</listener-class>
	</listener>

	<servlet>
		<servlet-name>ptSampleServlet</servlet-name>
		<servlet-class>org.springframework.security.samples.cas.web.ProxyTicketSampleServlet</servlet-class>
	</servlet>

	<servlet-mapping>
		<servlet-name>ptSampleServlet</servlet-name>
		<url-pattern>/secure/ptSample</url-pattern>
	</servlet-mapping>
	<error-page>
		<error-code>401</error-code>
		<location>/401.jsp</location>
	</error-page>
	<error-page>
		<error-code>403</error-code>
		<location>/403.jsp</location>
	</error-page>
</web-app>
