<?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"
         xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
         version="3.1">
    <session-config>
        <session-timeout>
            30
        </session-timeout>
    </session-config>
   <context-param>
        <param-name>
            javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL
        </param-name>
        <param-value>true</param-value>
    </context-param>
    <servlet>
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>*.xhtml</url-pattern>
    </servlet-mapping>
    <welcome-file-list>
        <welcome-file>index.xhtml</welcome-file>
    </welcome-file-list>
    <security-constraint>
        <display-name>AdminConstraint</display-name>
        <web-resource-collection>
            <web-resource-name>admin</web-resource-name>
            <description>Administration area</description>
            <url-pattern>/admin/*</url-pattern>
        </web-resource-collection>
        <auth-constraint>
            <description/>
            <role-name>Administrator</role-name>
        </auth-constraint>
    </security-constraint>
    <security-constraint>
        <display-name>Rest constraint</display-name>
        <web-resource-collection>
            <web-resource-name>Status service</web-resource-name>
            <description/>
            <url-pattern>/resources/status/*</url-pattern>
        </web-resource-collection>
        <auth-constraint>
            <description/>
            <role-name>Guardian</role-name>
            <role-name>Administrator</role-name>
        </auth-constraint>
    </security-constraint>
    <login-config>
        <auth-method>FORM</auth-method>
        <realm-name>tutoringRealm</realm-name>
        <form-login-config>
            <form-login-page>/login.xhtml</form-login-page>
            <form-error-page>/loginError.xhtml</form-error-page>
        </form-login-config>
    </login-config>
    <security-role>
        <description/>
        <role-name>Administrator</role-name>
    </security-role>
    <security-role>
        <description/>
        <role-name>Guardian</role-name>
    </security-role>
    <security-role>
        <description/>
        <role-name>Student</role-name>
    </security-role>
    <security-role>
        <description/>
        <role-name>User</role-name>
    </security-role>
    <error-page>
        <exception-type>javax.faces.application.ViewExpiredException</exception-type>
        <location>/index.xhtml</location>
    </error-page>
    <data-source>
        <description>Duke's Tutoring data source.</description>
        <name>java:global/TutoringDataSource</name>
        <class-name>org.apache.derby.jdbc.ClientDataSource</class-name>
        <server-name>localhost</server-name>
        <port-number>1527</port-number>
        <database-name>tutoring</database-name>
        <user>tutoring</user>
        <password>app</password>
        <property>
            <name>connectionAttributes</name>
            <value>;create=true</value>
        </property>
        <!--url>jdbc:derby://localhost:1527/tutoring;create=true</url-->
    </data-source>
</web-app>
