I need to define security-constraints for three different sections of my webapplication. One for /admin/*
, one for /account/*
and a tricky one. This last one should match everything except the preceding url-patterns (/*
excluding /admin/*
and /account/*
). How do I create this constraint?
<security-constraint>
<web-resource-collection>
<web-resource-name>AdminPanel</web-resource-name>
<url-pattern>/admin/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>admin</role-name>
</auth-constraint>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
<security-constraint>
<web-resource-collection>
<web-resource-name>AccountPanel</web-resource-name>
<url-pattern>/account/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>account</role-name>
</auth-constraint>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
<security-constraint>
<web-resource-collection>
<web-resource-name>HTTPSOnly</web-resource-name>
<url-pattern>`/* excluding /admin/*, /account/*`</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>visitor</role-name>
</auth-constraint>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>