Security Constraint Definition Example
The following is sample web.xml code to define a security constraint.
<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5"> <display-name>Test WebApp</display-name> <security-constraint> <web-resource-collection> <web-resource-name>Admin Role</web-resource-name> <url-pattern>/dump/auth/admin/*</url-pattern> <url-pattern>*.htm</url-pattern> </web-resource-collection> <auth-constraint> <role-name>content-administrator</role-name> </auth-constraint> </security-constraint> <security-constraint> <web-resource-collection> <web-resource-name>Super User Role</web-resource-name> <url-pattern>/dump/auth/admin/*</url-pattern> <url-pattern>/dump/auth/display/*</url-pattern> <http-method>HEAD</http-method> </web-resource-collection> <web-resource-collection> <web-resource-name>Super User Role</web-resource-name> <url-pattern>/dump/auth/system/*</url-pattern> </web-resource-collection> <auth-constraint> <role-name>Super-User</role-name> </auth-constraint> </security-constraint> </web-app>
Copyright © Cloud Software Group, Inc. All rights reserved.