You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Ja...@web.de on 2008/01/10 12:53:00 UTC

Modify JDBC Realm

Hi,

I want to authenticate users in my web application using the JDBC realm. Unfortunately the user tables already exist and don't match the standard configuration for the realm. Loading the users works fine but I have an additional user-role-relation table. So I have to modify the following method:

    protected PreparedStatement roles(Connection dbConnection, String username)
        throws SQLException {

        if (preparedRoles == null) {
            StringBuffer sb = new StringBuffer("SELECT ");
            sb.append(roleNameCol);
            sb.append(" FROM ");
            sb.append(userRoleTable);
            sb.append(" WHERE ");
            sb.append(userNameCol);
            sb.append(" = ?");
            preparedRoles =
                dbConnection.prepareStatement(sb.toString());
        }

        preparedRoles.setString(1, username);
        return (preparedRoles);

    }

Is there eny smart possibility to modify this method or is there even another solution for my problem?

Regards,
Jason
_________________________________________________________________________
In 5 Schritten zur eigenen Homepage. Jetzt Domain sichern und gestalten! 
Nur 3,99 EUR/Monat! http://www.maildomain.web.de/?mc=021114


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Modify JDBC Realm

Posted by Mark Thomas <ma...@apache.org>.
JasDA@web.de wrote:
> Is there eny smart possibility to modify this method or is there even another solution for my problem?

Use a view for the roles table.

Mark


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org