JDBCEncryptionRealm |
public class JDBCEncryptionRealm extends RealmBase (Code) |
| This Realm included the functionality of both the standard tomcat
org.apache.catalina.realm.JDBCRealm JDBCRealm and the
org.apache.catalina.realm.DataSourceRealm DataSourceRealm ,
in one class. It also included the ability to perform custom
password encryption using 3rd party classes (if your encryption scheme is not
supported by the default MessageDigest class in the JCE libraries).
This new version works with Tomcat 4.1 and higher, the previous version that doesn't
have the DataSource code in it, works with ther earlier Tomcat 4.0 release
The code based for this classes was taken from the Tomcat 4.1.26 release
The two properties used for encryption are : encryptionClass and encryptionMethod.
With these set, the realm introspects for the named class for the names method. It
is expected that the method has one of the following signatures
public static String methodName(String password)
or
public static String methodName(String password, String username)
The method should return a string, that should match the value retrieved from the
database. This allow one-way encryption algorithms to be used. No decryption facility
needs to be provided.
In addition to the original JDBCRealm/DataSource this realm
- does not throw a NullPointerException if the database password is null
- considers a user validated if the database and entered password are both null
- provided one-way password encryption prior to comparing them
- allows extention to the query to get the user's credentials
- allows a custom query to be suppplied for getting the user's roles
- Message levels for 'debug' parameter are 0 ->None, 2+ ->Errors, 5+ ->Warnings, 10+ ->Debug
New in Version 1.3
- Adds support for DataSources. If the 'dataSourceName' is passed it overrides
the use of a regular connection, therefore it ignores the values for
connectionName,
connectionPassword, connectionURL and driverName
- Uses its own LocalStrings for messages, incase you want to implement a diffenent language
For more documentation see the Jaffa Web Site
author: Paul Extance version: 1.3 |