I have a java webapp that uses web.xml to configure its security:
<security-constraint>
<web-resource-collection>
<web-resource-name>webPages</web-resource-name>
<description>All web resources</description>
<url-pattern></url-pattern>
<url-pattern>/admin/*</url-pattern>
<http-method>POST</http-method>
<http-method>GET</http-method>
</web-resource-collection>
<auth-constraint>
<role-name>admins</role-name>
</auth-constraint>
<user-data-constraint>
<description>SSL not required</description>
<transport-guarantee>NONE</transport-guarantee>
</user-data-constraint>
</security-constraint>
I want all pages under /admin/* to be protected, and this works. the user correctly first sees a loginscreen, and is redirected afterwards to the original requested page.
I would also like my context root to protected: http://host:port/context/ However, when I configure the pattern <url-pattern></url-pattern>
and make a request to the root, my java controller just starts working and shows the view without the user ever seeing the login screen. Why does this pattern work for things like <servlet-mapping>
(to map the request to the spring servlet) but not as a security constraint?
I ttried in both chrome and firefox and restarted multiple times.