schemaVersion: "1.0"
pattern:
  id: "cc7f74cd87053a74a70588ad"
  className: "ch.nevis.admin.v4.plugin.nevisproxy.patterns.GenericHostContextSettings"
  name: "SessionTimeoutPostprocessing"
  properties:
    filters: "    <filter>\n        <filter-name>Lua_${name}</filter-name>\n     \
      \   <filter-class>ch::nevis::isiweb4::filter::lua::LuaFilter</filter-class>\n\
      \        <init-param>\n            <param-name>Script.OutputHeaderFunctionName</param-name>\n\
      \            <param-value>outputHeader</param-value>\n        </init-param>\n\
      \    <init-param>\n        <param-name>Script</param-name>\n        <param-value>\n\
      function outputHeader(req, resp)\n  if resp:getStatus() == 205 then\n    if\
      \ resp:getHeader(\"IDP-AUTH\") == \"Timeout\" then\n      trace = req:getTracer()\n\
      \      trace:debug(\"Changed status to 408, Session Timeout\") \n      resp:setStatus(408)\n\
      \      resp:removeHeader(\"IDP-AUTH\")\n      resp:removeHeader(\"Location\"\
      )\n      resp:setBody(\"&lt;HTML&gt;&lt;BODY&gt;Timeout&lt;/BODY&gt;&lt;/HTML&gt;\"\
      )\n      resp:send(408)\n    end\n  end\nend\n       </param-value>\n    </init-param>\n\
      \        <init-param>\n          <param-name>RequestFlags</param-name>\n   \
      \       <param-value>+NEEDS_REDIRECT,+HAS_RESPONSE_CONDITION</param-value>\n\
      \        </init-param>\n    </filter>\n\n    <filter-mapping>\n        <filter-name>Lua_${name}</filter-name>\n\
      \        <url-pattern>/SAML2/SSO/*</url-pattern>\n    </filter-mapping>\n  \
      \  <filter-mapping>\n        <filter-name>Lua_${name}</filter-name>\n      \
      \  <url-pattern>/AUTH/RECOVERY/*</url-pattern>\n    </filter-mapping>\n"
    filterMappings: "manual"
    phase: "BEFORE_SANITATION"
