<?xml version="1.0" encoding="ISO-8859-1" ?>

<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">
  
  <display-name>ksdemo</display-name>

  <!--Uncomment for clustered setup -->
  <!-- -->
  <distributable />

  <context-param>
    <param-name>org.exoplatform.frameworks.jcr.command.web.fckeditor.digitalAssetsWorkspace</param-name>
    <param-value>portal</param-value>
  </context-param>

  <context-param>
    <param-name>org.exoplatform.frameworks.jcr.command.web.fckeditor.digitalAssetsPath</param-name>
    <param-value>/</param-value>
  </context-param>

  <!-- ================================================================== -->
  <!-- RESOURCE FILTER TO CACHE MERGED JAVASCRIPT AND CSS -->
  <!-- ================================================================== -->
  <!--filter>
    <filter-name>LocalizationFilter</filter-name>
    <filter-class>org.exoplatform.portal.application.localization.LocalizationFilter</filter-class>
  </filter-->
  <filter>
    <filter-name>GenericFilter</filter-name>
    <filter-class>org.exoplatform.web.filter.GenericFilter</filter-class>
  </filter>
  <filter>
    <filter-name>ResourceRequestFilter</filter-name>
    <filter-class>org.exoplatform.portal.application.ResourceRequestFilter</filter-class>
  </filter>

  <filter>
    <filter-name>ThreadLocalSessionProviderInitializedFilter</filter-name>
    <filter-class>org.exoplatform.frameworks.jcr.web.ThreadLocalSessionProviderInitializedFilter</filter-class>
  </filter>

  <filter>
    <filter-name>SetCurrentIdentityFilter</filter-name>
    <filter-class>org.exoplatform.services.security.web.SetCurrentIdentityFilter</filter-class>
    <init-param>
      <param-name>restoreIdentity</param-name>
      <param-value>true</param-value>
    </init-param>
  </filter>

  <filter>
    <filter-name>RestEncodingFilter</filter-name>
    <filter-class>org.exoplatform.services.rest.servlet.RestEncodingFilter</filter-class>
    <init-param>
      <param-name>REQUEST_ENCODING</param-name>
      <param-value>UTF-8</param-value>
    </init-param>
  </filter>

  <filter>
    <filter-name>CacheUserProfileFilter</filter-name>
    <filter-class>org.exoplatform.web.CacheUserProfileFilter</filter-class>
  </filter>

  <filter>
    <filter-name>RememberMeFilter</filter-name>
    <filter-class>org.exoplatform.web.login.RememberMeFilter</filter-class>
  </filter>

  <filter>
    <filter-name>ClusteredSSOFilter</filter-name>
    <filter-class>org.exoplatform.web.login.ClusteredSSOFilter</filter-class>
  </filter>

  <filter>
    <filter-name>PortalContainerFilter</filter-name>
    <filter-class>org.exoplatform.container.web.PortalContainerFilter</filter-class>
  </filter>

  <filter-mapping>
    <filter-name>PortalContainerFilter</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>

  <filter-mapping>
    <filter-name>RememberMeFilter</filter-name>
    <servlet-name>portal</servlet-name>
  </filter-mapping>

  <filter-mapping>
    <filter-name>ClusteredSSOFilter</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>

  <!--filter-mapping>
    <filter-name>LocalizationFilter</filter-name>
    <url-pattern>/*</url-pattern>
    <dispatcher>INCLUDE</dispatcher>
    <dispatcher>FORWARD</dispatcher>
    <dispatcher>REQUEST</dispatcher>
    <dispatcher>ERROR</dispatcher>
  </filter-mapping-->

  <filter-mapping>
    <filter-name>ResourceRequestFilter</filter-name>
    <url-pattern>*.css</url-pattern>
  </filter-mapping>

  <filter-mapping>
    <filter-name>ResourceRequestFilter</filter-name>
    <url-pattern>*.gif</url-pattern>
  </filter-mapping>

  <filter-mapping>
    <filter-name>ResourceRequestFilter</filter-name>
    <url-pattern>*.png</url-pattern>
  </filter-mapping>

  <filter-mapping>
    <filter-name>ResourceRequestFilter</filter-name>
    <url-pattern>*.jpg</url-pattern>
  </filter-mapping>

  <filter-mapping>
    <filter-name>ResourceRequestFilter</filter-name>
    <url-pattern>/javascript/*</url-pattern>
  </filter-mapping>

  <filter-mapping>
    <filter-name>SetCurrentIdentityFilter</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>

  <filter-mapping>
    <filter-name>ThreadLocalSessionProviderInitializedFilter</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>

  <filter-mapping>
    <filter-name>CacheUserProfileFilter</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>

  <filter-mapping>
    <filter-name>RestEncodingFilter</filter-name>
    <url-pattern>/rest/*</url-pattern>
  </filter-mapping>

  <filter-mapping>
    <filter-name>GenericFilter</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>

  <!-- ================================================================== -->
  <!-- LISTENER -->
  <!-- ================================================================== -->
  <listener>
    <listener-class>org.exoplatform.web.GenericHttpListener</listener-class>
  </listener>
  <listener>
    <listener-class>org.exoplatform.services.security.web.JAASConversationStateListener</listener-class>
  </listener>
  <!-- ================================================================== -->
  <!-- SERVLET -->
  <!-- ================================================================== -->
  <servlet>
    <servlet-name>portal</servlet-name>
    <servlet-class>org.exoplatform.portal.application.PortalController</servlet-class>
    <init-param>
      <param-name>webui.configuration</param-name>
      <param-value>app:/WEB-INF/webui-configuration.xml</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
  </servlet>

  <servlet>
    <servlet-name>RestServer</servlet-name>
    <servlet-class>org.exoplatform.services.rest.servlet.RestServlet</servlet-class>
    <load-on-startup>4</load-on-startup>
  </servlet>

  <servlet>
    <servlet-name>javascript</servlet-name>
    <servlet-class>org.exoplatform.portal.webui.javascript.JavascriptServlet</servlet-class>
  </servlet>

  <servlet>
    <servlet-name>Controller</servlet-name>
    <servlet-class>org.exoplatform.frameworks.jcr.web.CommandControllerServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>

  <servlet>
    <servlet-name>PortalLoginController</servlet-name>
    <servlet-class>org.exoplatform.web.security.PortalLoginController</servlet-class>
  </servlet>
  <servlet>
    <servlet-name>InitiateLoginServlet</servlet-name>
    <servlet-class>org.exoplatform.web.login.InitiateLoginServlet</servlet-class>
  </servlet>
  <servlet>
    <servlet-name>DoLoginServlet</servlet-name>
    <servlet-class>org.exoplatform.web.login.DoLoginServlet</servlet-class>
  </servlet>
  <servlet>
    <servlet-name>ErrorLoginServlet</servlet-name>
    <servlet-class>org.exoplatform.web.login.ErrorLoginServlet</servlet-class>
  </servlet>

  <servlet>
    <servlet-name>GateInServlet</servlet-name>
    <servlet-class>org.gatein.wci.api.GateInServlet</servlet-class>
    <load-on-startup>0</load-on-startup>
  </servlet>

  <servlet>
    <servlet-name>StickyCaptcha</servlet-name>
    <servlet-class>org.exoplatform.web.security.CaptchaServlet</servlet-class>
    <init-param>
      <param-name>width</param-name>
      <param-value>200</param-value>
    </init-param>
    <init-param>
      <param-name>height</param-name>
      <param-value>75</param-value>
    </init-param>
  </servlet>

  <!-- ================================================================= -->

  <servlet-mapping>
    <servlet-name>InitiateLoginServlet</servlet-name>
    <url-pattern>/initiatelogin</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
    <servlet-name>ErrorLoginServlet</servlet-name>
    <url-pattern>/errorlogin</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
    <servlet-name>PortalLoginController</servlet-name>
    <url-pattern>/login</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
    <servlet-name>DoLoginServlet</servlet-name>
    <url-pattern>/dologin</url-pattern>
  </servlet-mapping>

  <servlet-mapping>
    <servlet-name>javascript</servlet-name>
    <url-pattern>/javascript/*</url-pattern>
  </servlet-mapping>

  <servlet-mapping>
    <servlet-name>RestServer</servlet-name>
    <url-pattern>/rest-ksdemo/*</url-pattern>
  </servlet-mapping>

  <servlet-mapping>
    <servlet-name>Controller</servlet-name>
    <url-pattern>/connector</url-pattern>
  </servlet-mapping>

  <servlet-mapping>
    <servlet-name>portal</servlet-name>
    <url-pattern>/</url-pattern>
  </servlet-mapping>

  <servlet-mapping>
    <servlet-name>StickyCaptcha</servlet-name>
    <url-pattern>/captcha</url-pattern>
  </servlet-mapping>

  <!-- Explicit mappings (due to portal servlet on '/') for UIHomePagePortlet, need to find out how to improve that -->
  <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>
  <servlet-mapping>
    <servlet-name>default</servlet-name>
    <url-pattern>*.gif</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>*.css</url-pattern>
  </servlet-mapping>

  <servlet-mapping>
    <servlet-name>GateInServlet</servlet-name>
    <url-pattern>/gateinservlet</url-pattern>
  </servlet-mapping>

  <session-config>
    <session-timeout>30</session-timeout>
  </session-config>

  <security-constraint>
    <web-resource-collection>
      <web-resource-name>user authentication</web-resource-name>
      <url-pattern>/dologin</url-pattern>
      <url-pattern>/private/*</url-pattern>
      <url-pattern>/standalone/*</url-pattern>
      <url-pattern>/groups/*</url-pattern>
      <url-pattern>/users/*</url-pattern>
      <http-method>POST</http-method>
      <http-method>GET</http-method>
    </web-resource-collection>
    <auth-constraint>
      <role-name>users</role-name>
    </auth-constraint>
    <user-data-constraint>
      <transport-guarantee>NONE</transport-guarantee>
    </user-data-constraint>
  </security-constraint>
  <security-constraint>
    <web-resource-collection>
      <web-resource-name>admin authentication</web-resource-name>
      <url-pattern>/admin/*</url-pattern>
      <http-method>POST</http-method>
      <http-method>GET</http-method>
    </web-resource-collection>
    <auth-constraint>
      <role-name>admin</role-name>
    </auth-constraint>
    <user-data-constraint>
      <transport-guarantee>NONE</transport-guarantee>
    </user-data-constraint>
  </security-constraint>
  <login-config>
    <auth-method>FORM</auth-method>
    <realm-name>gatein-domain-ksdemo</realm-name>
    <form-login-config>
      <form-login-page>/initiatelogin</form-login-page>
      <form-error-page>/errorlogin</form-error-page>
    </form-login-config>
  </login-config>
  <security-role>
    <description>a simple user role</description>
    <role-name>users</role-name>
  </security-role>
  <security-role>
    <description>the admin role</description>
    <role-name>admin</role-name>
  </security-role>
</web-app>