You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Paul Lamb <pa...@oil-law.com> on 2000/12/27 00:07:44 UTC
T4 JDBCRealm another change
I thought I'd toss in another change to JDBC Realm, specifically the
ability to override the SQL query used for the password and the roles.
It let's you have a config like:
<!--
<Realm className="org.apache.catalina.realm.JDBCRealm" debug="99"
driverName="sun.jdbc.odbc.JdbcOdbcDriver"
connectionURL="jdbc:odbc:CATALINA"
<!-- for both the user and the roles queries only the first
column
in the result set is looked at for the password and
role -->
userQuery="SELECT user_pass FROM users WHERE user_name = ?"
userRoleQuery="SELECT role_name FROM roles WHERE user_name =
?"
/>
This gives people the ability to use SQL statements that may involve
joins, which is something I need to get the roles correctly.
Paul Lamb
>
> Hola David:
>
> Sorry for the delay, just catched your message in the archive.
>
> >
> > * Would it be acceptable for me to submit a patch for this code that
> > currently gets repeated in 2-3 different places ( in a few
> > different ways
> > for Tomcat 3.2 ), moving the act of reconnecting to the
> > database to it's own
> > seperate method that either returns void or returns a connection.
> >
>
> 3.3 JDBCRealm is now doing that in this way, but i use a boolean
> checkConnection(), I have planned backport this snippet soon ( this
> night ) but in the review i have found some things that can
> done better
> too, as translating the log methods from SimpleRealm and JDBCRealm to
> BaseRealm,
>
> What do you think Craig?
>
> > * Would this adversely affect the amount of logging that is
> > done in the
> > current code?
>
> I think JDBCRealm is doing too much logging now, so no problem.
>
> > * If I am interpreting the logic that checks for the presence of a
> > connection name and connection password correctly, in the
> > case that only
> > *one* of them is empty or null, the three parameter
> > getConnection method is
> > used. Is it possible that this could cause problems as well?
>
> i think you are right, i will change this in ALL tomcat versions ASAP,
> if nobody complaints.
>
> >
> > I apologize for not catching this with my original patch,
> and for not
>
> No problem, Thanks to point on this , i will try to do it ASAP,
>
>
> Saludos ,
> Ignacio J. Ortega
>