In a browser, I'll attempt to hit the test servletW via http://localhost:8080/tomcat-demo/test. Since we're using Basic authentication and this is a protected resource, a pop-up window appears asking for a name and password.

I'll try entering an invalid name and password. This doesn't work.

I'll enter a good name and password. In our tomcat_realm databaseW, we created a user called 'deron' with a password of 'deronpass'. The 'deron' user has the roles of 'dude' and 'manager'. Since our web.xmlW specifies that a user with the role of 'dude' is required, 'deron'/'deronpass' should work.

The user name and password is authenticated, and we are granted access to the test servlet.

In this tutorial, we've seen that it is quite straightforward to set up Tomcat with a JDBCW realm with MySQLW in order to perform container-based authentication.