I'm trying to secure my web application in tomcat with web.xml and tomcat-users.xml but it's not working. I've getting 401 error with the correct login and password.
My web.xml security part:
<security-constraint>
<web-resource-collection>
<web-resource-name>Web Application</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>myuser</role-name>
</auth-constraint>
</security-constraint>
<security-role>
<role-name>myuser</role-name>
</security-role>
<login-config>
<auth-method>BASIC</auth-method>
</login-config>
My tomcat-users.xml:
<?xml version="1.0" encoding="UTF-8"?>
<tomcat-users xmlns="http://tomcat.apache.org/xml"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://tomcat.apache.org/xml tomcat-users.xsd"
version="1.0">
<role rolename="myuser"/>
<role username="myuser" password="myuser" role="myuser"/>
</tomcat-users>