Source

maven-embedded-tomcat-auth-tutorial / src / main / webapp / WEB-INF / web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
    
    <welcome-file-list>
    	<welcome-file>/test.jsp</welcome-file>
    </welcome-file-list>
    
    <security-role>
        <role-name>admin</role-name>
    </security-role>
    
    <security-constraint>
        <display-name>MySecurityConstraint</display-name>
        <web-resource-collection>
            <web-resource-name>securedresources</web-resource-name>
            <url-pattern>/secure/*</url-pattern>
        </web-resource-collection>
        <auth-constraint>
            <role-name>admin</role-name>
        </auth-constraint>
    </security-constraint>
    
    <login-config>
        <auth-method>BASIC</auth-method>
        <realm-name>hasCode.com Secured Area</realm-name>
    </login-config>
</web-app>