<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         version="3.1"
         xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd">
  <display-name>KieServer</display-name>
  <servlet>
    <servlet-name>org.kie.server.remote.rest.common.KieServerApplication</servlet-name>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>org.kie.server.remote.rest.common.KieServerApplication</servlet-name>
    <url-pattern>/services/rest/*</url-pattern>
  </servlet-mapping>

  <security-constraint>
    <web-resource-collection>
      <web-resource-name>Swagger web resources</web-resource-name>
      <url-pattern>/services/rest/server/swagger.json/*</url-pattern>
      <url-pattern>/services/rest/server/files/*</url-pattern>
      <url-pattern>/docs/*</url-pattern>
      <http-method>GET</http-method>
    </web-resource-collection>
    <!-- No authentication. Swagger resources should be accessible without authentication and files (form rendering). -->
  </security-constraint>
  <security-constraint>
    <web-resource-collection>
      <web-resource-name>KIE Server Health and Readiness Probes</web-resource-name>
      <url-pattern>/services/rest/server/readycheck</url-pattern>
      <url-pattern>/services/rest/server/healthcheck</url-pattern>
      <http-method>GET</http-method>
    </web-resource-collection>
    <!-- No authentication KIE Server Health and Readiness Probes  -->
  </security-constraint>
  <security-constraint>
    <web-resource-collection>
      <web-resource-name>REST web resources</web-resource-name>
      <url-pattern>/services/rest/*</url-pattern>
      <http-method>GET</http-method>
      <http-method>PUT</http-method>
      <http-method>POST</http-method>
      <http-method>DELETE</http-method>
    </web-resource-collection>
    <auth-constraint>
      <role-name>kie-server</role-name>
      <role-name>user</role-name>
    </auth-constraint>
  </security-constraint>
  <security-constraint>
    <web-resource-collection>
      <web-resource-name>REST web resources</web-resource-name>
      <url-pattern>/services/rest/*</url-pattern>
      <http-method>OPTIONS</http-method>
    </web-resource-collection>
    <!-- No authentication.  -->
  </security-constraint>
  <login-config>
    <auth-method>BASIC</auth-method>
    <realm-name>KIE Server</realm-name>
  </login-config>
  <security-role>
    <role-name>kie-server</role-name>
  </security-role>
  <security-role>
    <role-name>user</role-name>
  </security-role>

  <deny-uncovered-http-methods />

</web-app>
