<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
  ~
  ~ WSO2 Inc. licenses this file to you under the Apache License,
  ~ Version 2.0 (the "License"); you may not use this file except
  ~ in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~ http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing,
  ~ software distributed under the License is distributed on an
  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  ~ KIND, either express or implied. See the License for the
  ~ specific language governing permissions and limitations
  ~ under the License.
  -->
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns="http://java.sun.com/xml/ns/javaee"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
         version="2.5">
    <display-name>Android-Agent-Webapp</display-name>
    <servlet>
        <description>JAX-WS/JAX-RS MDM Android Endpoint</description>
        <display-name>JAX-WS/JAX-RS Servlet</display-name>
        <servlet-name>CXFServlet</servlet-name>
        <servlet-class>
            org.apache.cxf.transport.servlet.CXFServlet
        </servlet-class>
        <!-- configure a security filter -->
        <init-param>
            <param-name>swagger.security.filter</param-name>
            <param-value>ApiAuthorizationFilterImpl</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>CXFServlet</servlet-name>
        <url-pattern>/*</url-pattern>
    </servlet-mapping>
    <session-config>
        <session-timeout>60</session-timeout>
    </session-config>
    <context-param>
        <param-name>managed-api-enabled</param-name>
        <param-value>true</param-value>
    </context-param>
    <context-param>
        <param-name>doAuthentication</param-name>
        <param-value>true</param-value>
    </context-param>
	<context-param>
		<param-name>isSharedWithAllTenants</param-name>
		<param-value>true</param-value>
	</context-param>
    <context-param>
        <param-name>isDefault</param-name>
        <param-value>false</param-value>
    </context-param>
    <!--<context-param>-->
    <!--<param-name>managed-api-version</param-name>-->
    <!--<param-value>1.0.0</param-value>-->
    <!--</context-param>-->
    <!--<context-param>-->
    <!--<param-name>managed-api-isSecured</param-name>-->
    <!--<param-value>true</param-value>-->
    <!--</context-param>-->

    <!-- Below configuration is used to redirect http requests to https -->
    <!--security-constraint>
        <web-resource-collection>
            <web-resource-name>MDM-Admin</web-resource-name>
            <url-pattern>/*</url-pattern>
        </web-resource-collection>
        <user-data-constraint>
            <transport-guarantee>CONFIDENTIAL</transport-guarantee>
        </user-data-constraint>
    </security-constraint-->

    <filter>
        <filter-name>ApiOriginFilter</filter-name>
        <filter-class>org.wso2.carbon.mdm.services.android.util.ApiOriginFilter</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>ApiOriginFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

</web-app>
