If you need to restrict access to your web application via Basic HTTP authentication, add the following lines to tomcat configs: File: /etc/tomcat6/web.xml <security-constraint> <web-resource-collection> <web-resource-name>The entire webapp</web-resource-name> <url-pattern>/*</url-pattern> </web-resource-collection> <auth-constraint> <role-name>tomcat</role-name> </auth-constraint> </security-constraint> <login-config> <auth-method>BASIC</auth-method> <realm-name>Please, enter your login credentials!</realm-name> </login-config> <security-role> <role-name>tomcat</role-name> </security-role> File: /etc/tomcat6/tomcat-users.xml <tomcat-users> <user username="username" password="plain_password" roles="tomcat" /> </tomcat-users> Do [...]
If you enjoy our post, feel free to subscribes to our rss feeds