I posted this same query at stackoverflow a couple of days back, but with no response, although I've simplified the issue very slightly since then.

http://stackoverflow.com/questions/36653744/tomcat-7-wrong-realm-being-used

I have a realm defined in server.xml:

<Engine name="Catalina" defaultHost="localhost">
<Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true" deployIgnore="^welcome.*"> <Realm className="org.apache.catalina.realm.LockOutRealm" failureCount="3" lockOutTime="3600">
      <Realm className="org.apache.catalina.realm.JDBCRealm"
             driverName="org.postgresql.Driver"
             connectionURL = "jdbc:postgresql://localhost:5432/tomcat"
             connectionName="tomcat"
             connectionPassword="xxxxx"
             userTable = "users"
             userNameCol="user_name" userCredCol="user_pass"
             userRoleTable="user_roles"
             roleNameCol="role_name"
      />
    </Realm>
  </Host>
</Engine>

and two web applications, both inside the webapps folder on the tomcat server, with identical security settings in their web.xml files:

<security-role>
  <role-name>test-role</role-name>
</security-role>

<security-constraint>
  <web-resource-collection>
    <web-resource-name>Memory Realm</web-resource-name>
    <url-pattern>/*</url-pattern>
  </web-resource-collection>
  <auth-constraint>
    <role-name>test-role</role-name>
  </auth-constraint>
</security-constraint>

<login-config>
  <auth-method>BASIC</auth-method>
</login-config>


However, one application uses the JDBCRealm, as I'd expect, while the other uses conf/tomcat-users.xml. Looking at the postgresql logs, the second application never even queries the database.

I can't see anything different in the two configurations. Without any declaration of a UserDatabaseRealm I don't
see how any applications would get to look at tomcat-users.xml.

I'm wondering if anyone here could help me diagnose what's wrong.

Richard

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to