1 .
Add :
<security-constraint>
<web-resource-collection>
<web-resource-name>Wildcard means whole app requires authentication</web-resource-name>
<!-- this will decide on what folder you need authentication /* means all folders or root dir give this path according to your requirement.-->
<url-pattern>/*</url-pattern>
<http-method>GET</http-method>
<http-method>POST</http-method>
</web-resource-collection>
<auth-constraint>
<!-- rolename added in tomcat-user.xml-->
<role-name>authrole</role-name>
</auth-constraint>
