Tomcat manager with SSO and a different Realm
Monday, March 16th, 2009Tomcat Manager’s default configuration isn’t pratical (nor secure): you must store your users and passwords in a plain XML file. Of course, you can change the “<Realm>” definition on “<Engine name=’Catalina’>”, but it has no effect if you need a host with Single Sign On.
Since Manager needs to share the same host with managed applications, you need to create a context.xml for your Manager:
<?xml version="1.0" encoding="UTF-8"?> <Context path="/manager" privileged="true"> <Realm className="my.secure.and.custom.Realm"/> </Context>
Put it on “conf/<engine>/<host>/manager.xml”. The “privileged=’true’” will prevent a “java.lang.SecurityException: Servlet of class org.apache.catalina.manager.HTMLManagerServlet is privileged and cannot be loaded by this web application”.
You must change “webapps/manager/WEB-INF/web.xml” and replace “<role-name>manager</role-name>” with the name of the role you want.