Bojan Smojver wrote:
> 
> Just playing with Form authentication in TC 3.3. Have two Velocity pages
> that are doing the authentication with a JDBC Realm (for that context
> only). When Tomcat starts, all is fine. I get authenticated (or not)
> depending on username/password combination I supply. Subsequent visits
> to the same page do not require additional authentication. Excellent!
> 
> If I update the application (automatic reloading is enabled) and attempt
> to hit the same page again, I get prompted for new authentication. Cool.
> But although I specify the correct username/password combination, I
> can't log in.
> 
> Is this something that happens by design or am I looking at a possible
> bug?

It seems that context's JDBCRealm does not get hooked into Interceptors
when the context reloads. These are the relevant interceptors first time
around (first three from server.xml, fourth from apps-*.xml):

--------------------------------------------------
Auth interceptor is: org.apache.tomcat.modules.config.PathSetter@ed8b59e
Auth interceptor is:
org.apache.tomcat.modules.config.ServerXmlReader@2c72759e
Auth interceptor is:
org.apache.tomcat.modules.aaa.CredentialsInterceptor@5393359e
Auth interceptor is: org.apache.tomcat.modules.aaa.JDBCRealm@7b08b59d
--------------------------------------------------

and this is after the reload (only the ones from server.xml, the stuff
from apps-*xml didn't show up this time):

--------------------------------------------------
Auth interceptor is: org.apache.tomcat.modules.config.PathSetter@ed8b59e
Auth interceptor is:
org.apache.tomcat.modules.config.ServerXmlReader@2c72759e
Auth interceptor is:
org.apache.tomcat.modules.aaa.CredentialsInterceptor@5393359e
--------------------------------------------------

These things are printed out by me from getRemoteUser() method in
Request.java. Just need to find where those things get hooked and we'll
be laughing...

Just to bounce the validity of it against someone with more experience,
this is my apps-*.xml file:

--------------------------------------------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<Server>
    <Host name="www.dev.dev">
        <Context path="/" docBase="/home/httpd/html/dev.dev">
          <JDBCRealm
            debug="99"
            driverName="org.postgresql.Driver"
            connectionURL="jdbc:postgresql:dev"
            connectionName="dev"
            connectionPassword="developer"
            digest="MD5"
            userTable="users"
            userNameCol="username"
            userCredCol="password"
            userRoleTable="usersroles"
            roleNameCol="rolename"
        />
        </Context>
    </Host>
</Server>
--------------------------------------------------

Back to trenches now...

Bojan

Reply via email to