HI!!
Just solved.
I was using tomcat 5.5.0.
I was looking at sources of 5.5.16.
I suppose that the authenticate method of 5.5.0 doesn't use getPassord
method.
I tried it in 5.5.16 and everything works fine

Thanks for attention
Alessandro
On 3/24/06, Alessandro Colantoni <[EMAIL PROTECTED]> wrote:
>
>  Hi all!
> For some reasons I had to extend JDBCRealm to overwrite the method
> getPassword.
> This is myRealm:
>
> public class ManoloJDBCRealm extends JDBCRealm{
>     private static Log log = LogFactory.getLog(ManoloJDBCRealm.class);
>
>     protected String getPassword(String username) {
> System.out.println("username= "+username);
>         String password=super.getPassword(username);
>         log.info("password="+password);
>         String hexpassword=HexUtils.convert(password.getBytes());
>         log.info("hexpassword="+hexpassword);
>         return hexpassword;
>     }
>
> }
>
> I wrote the file mbeans-descriptors.xml
>
> <?xml version="1.0"?>
> <mbeans-descriptors>
>     <mbean name="ManoloJDBCRealm"  description="Implementation of Realm
> that works with any JDBC supported database" domain="Catalina" group="Realm"
> type=" com.steria.tc.realm.ManoloJDBCRealm">
>       <attribute name="className" description="Fully qualified class name
> of the managed object" type="java.lang.String" writeable="false" />
>       <attribute name="connectionName" description="The connection
> username to use when trying to connect to the database" type="
> java.lang.String" />
>       <attribute name="connectionPassword" description="The connection URL
> to use when trying to connect to the database" type=" java.lang.String" />
>       <attribute name="connectionURL" description="The connection URL to
> use when trying to connect to the database" type="java.lang.String" />
>       <attribute name="digest" description="Digest algorithm used in
> storing passwords in a non-plaintext format" type=" java.lang.String" />
>       <attribute name="driverName" description="The JDBC driver to use"
> type="java.lang.String" />
>       <attribute name="roleNameCol" description="The column in the user
> role table that names a role" type=" java.lang.String" />
>       <attribute name="userCredCol" description="The column in the user
> table that holds the user's credentials" type="java.lang.String" />
>       <attribute name="userNameCol" description="The column in the user
> table that holds the user's username" type=" java.lang.String" />
>       <attribute name="userRoleTable" description="The table that holds
> the relation between user's and roles" type="java.lang.String" />
>       <attribute name="userTable" description="The table that holds user
> data" type=" java.lang.String" />
>       <operation name="start" description="Start" impact="ACTION"
> returnType="void" />
>       <operation name="stop" description="Stop" impact="ACTION"
> returnType="void" />
>       <operation name="init" description="Init" impact="ACTION"
> returnType="void" />
>       <operation name="destroy" description="Destroy" impact="ACTION"
> returnType="void" />
>     </mbean>
> </mbeans-descriptors>
>
> I just copied it form the JDBCRealm and change the type.
>
> This file is in the same package of ManoloJDBCRealm.
>
> In server.xml I put
>
> <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"
>             debug="0"
>             descriptors="/com/steria/tc/realm/mbeans-descriptors.xml"/>
>
>
>
>
>
> I've done a jar with in com/steria/tc/realm/mbeans-descriptors.xml,
> ManoloJDBCRealm.class
>
> and I put it in server/lib
>
> In my context.xml I put
>
> <Realm className = "com.steria.tc.realm.ManoloJDBCRealm"....../>
>
> I start tomcat, I get no error, but when i authenticate I don't get one of
> the message of my custom getPassword(String username). The behavior is as if
> tomcat utilize the JDBCREalm method
>
> Thanks in advance Alessandro
>
>
>
>
>
>
>
>
>
>
>
>
>

Reply via email to