web.xml: security-constraint : web.xml « javax.servlet.http « Java by API






web.xml: security-constraint

<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
    "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">

<web-app>
    <security-constraint>
        <web-resource-collection>
            <web-resource-name>
                SecretProtection
            </web-resource-name>
            <url-pattern>
                /servlet/SalaryServer
            </url-pattern>
            <url-pattern>
                /servlet/secret
            </url-pattern>
            <http-method>
                GET
            </http-method>
            <http-method>
                POST
            </http-method>
        </web-resource-collection>
        <auth-constraint>
            <role-name>
                manager
            </role-name>
        </auth-constraint>
    </security-constraint>

    <login-config>
        <auth-method>
            BASIC       <!-- BASIC, DIGEST, FORM, CLIENT-CERT -->
        </auth-method>                                               
        <realm-name>                                                 
            Default     <!-- optional, only useful for BASIC -->     
        </realm-name>                                                
    </login-config>                                                  

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

           
       








Related examples in the same category

1.web.xml: filter-name and filter-mapping
2.web.xml: error page with error code
3.web.xml: error page with exception type
4.web.xml: context-param
5.web.xml: mime-mapping
6.web.xml: welcome-file-list
7.web.xml: session-config timeout
8.web.config: login-config
9.web.xml: servlet-name, init-param, servlet-mapping