<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd">

    <!-- windup-web-services/rest/resteasy/registry - See https://issues.jboss.org/browse/JBEAP-3669 -->
    <context-param>
        <param-name>resteasy.resources</param-name>
        <param-value>org.jboss.resteasy.plugins.stats.RegistryStatsResource</param-value>
    </context-param>

    <servlet>
        <description>Serves static files.</description>
        <servlet-name>FileServlet</servlet-name>
        <servlet-class>org.jboss.windup.web.services.servlet.FileDefaultServlet</servlet-class>
<!--         <init-param> -->
<!--             <param-name>base-path</param-name> -->
<!--             <param-value>${windup.data.dir}/windup/</param-value> -->
<!--         </init-param> -->
        <async-supported>true</async-supported>
    </servlet>

    <servlet-mapping>
        <servlet-name>FileServlet</servlet-name>
        <url-pattern>/static-report/*</url-pattern>
    </servlet-mapping>

    <security-constraint>
        <web-resource-collection>
            <web-resource-name>secured</web-resource-name>
            <url-pattern>/*</url-pattern>
        </web-resource-collection>
        <auth-constraint>
            <role-name>user</role-name>
        </auth-constraint>
    </security-constraint>

    <security-constraint>
        <web-resource-collection>
            <web-resource-name>Public</web-resource-name>
            <url-pattern>/websocket/*</url-pattern>
        </web-resource-collection>
        <web-resource-collection>
            <web-resource-name>Public</web-resource-name>
            <url-pattern>/registeredApplications/download/*</url-pattern>
        </web-resource-collection>
        <web-resource-collection>
            <web-resource-name>Public</web-resource-name>
            <url-pattern>/windup/executions/post-results/*</url-pattern>
        </web-resource-collection>
        <web-resource-collection>
            <web-resource-name>Public</web-resource-name>
            <url-pattern>/windup/executions/get-execution-request-tar/*</url-pattern>
        </web-resource-collection>
        <!--
         This is resource for Arquillian container used for testing.
         It is workaround until we find out how to make arquillian run without needing it
        -->
        <web-resource-collection>
            <web-resource-name>Public</web-resource-name>
            <url-pattern>/ArquillianServletRunner/*</url-pattern>
        </web-resource-collection>
    </security-constraint>

    <login-config>
        <auth-method>KEYCLOAK</auth-method>
    </login-config>

    <security-role>
        <role-name>user</role-name>
    </security-role>
</web-app>
