Hi Robert,
You are right in that implementing a JAAS module tends to be rather container specific. Usually you have to extend a container provided login module class instead of implementing LoginModule yourself. This can be frustrating when you are working on a more global solution.
There are two ways I can think of around this.
1) Develop a business class that performs the authentication work, and build caller classes that extend the classes provided by the container but call the business class to do all of the work. This way you can keep all of the logic out of the container specific code. This will also give you the flexibility to change the type of authentication (i.e.
jdbc, ldap...) at run time if you use a factory. This solution, while useful, can also be quite complex and time consuming.
2) Have you considered using a client side hash instead? I faced the same problem you did in a project, and chose instead to hash the password using a JavaScript function before sending it across the network. This way I could still use the j_security_check if I wanted to.
“Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.” - Rich Cook