English 中文(简体)
Configuring container-based authentication with alternative digest methods
原标题:

Following up on a prior question, I m trying to figure out how to set up container-based authentication for a J2EE application. Specifically, I need to be able to apply a password digest algorithm other than the ones supported by the java.security.MessageDigest (which are SHA, MD2, or MD5 - here s where I think that limitation is documented). In this case my database stores Blowfish-encrypted passwords.

I already have the Java code written to get the encrypted password from my database, and compare the user-entered password with the database one by performing the Blowfish encryption. How do I set it up so that the container just uses my own Java class(es) to perform user authentication?

I m using JBoss AS 5.1 (which I think means my Tomcat version is 6).

问题回答

You re going to need to write a custom LoginModule for JBoss.

In your case it should be trivial as all you want to do is to change how password gets encoded so you ll just extend the DatabaseServerLoginModule and override a single method like the example in the above link shows.

If you were to do it for a standalone Tomcat, you d have to write your own Realm. Again, reasonably straightforward as you can extend JDBC or Data Source realm

All the documentation I have been able to find online related to writing a custom login module only pertains to JBoss v4 or earlier. I have not been able to locate a single working example of doing this in JBoss v5.1. It is very frustrating. There are no javadocs for JBoss v5.1 that I can locate on the official JBoss website; in fact, there are no current security documents relating to custom modules at all, anywhere on the net. I have searched through every book I have access to in the Barnes & Noble, still no luck. At this point, we are looking into moving off of JBoss, b/c this lack of documentation is just unprofessional.





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签