Reputation: 283
I have configured tomcat 7 server to use MD5 digest in database realm configuration. It worked fine. Now I need to upgrade my servers to tomcat 8. But it generates a different hash for my my passwords in database. How can I configure it to generate same old values? I have already copied jdbc driver jars to lib folder in tomcat 8 and made all sh files in bin executable.
In simple, how can I make below two outputs equal. Tomcat 7:
~/apache-tomcat-7.0.69/bin$ ./digest.sh -a MD5 test
Listening for transport dt_socket at address: 5005
test:098f6bcd4621d373cade4e832627b4f6
~/apache-tomcat-7.0.69/bin$
Tomcat 8:
~/apache-tomcat-8.5.6/bin$ ./digest.sh -a MD5 test
test:27d6262696d98e0a8a973d43eef07c66c68b089a4ada21dd3ba0defc04ca302e$1$13a7c1932523dcea3bb39ef05b75b4c6
~/apache-tomcat-8.5.6/bin$
Thanks
Upvotes: 2
Views: 1433
Reputation: 283
Finally this solved my question.
To answer the first point, here's a comparison of the <Realm>
from my context.xml before and after the switch to Tomcat 8:
Before:
<Realm className="org.apache.catalina.realm.DataSourceRealm"
dataSourceName="jdbc/myDataSource"
roleNameCol="role" userCredCol="password" userNameCol="loginid"
digest="md5"
userRoleTable="userroles" userTable="users"
localDataSource="true" />
After:
<Realm className="org.apache.catalina.realm.DataSourceRealm"
dataSourceName="jdbc/myDataSource"
roleNameCol="role" userCredCol="password" userNameCol="loginid"
userRoleTable="userroles" userTable="users" localDataSource="true">
<CredentialHandler
className="org.apache.catalina.realm.MessageDigestCredentialHandler"
algorithm="md5" />
</Realm>
Upvotes: 8