Getting access to the DatabaseServerLoginModule

Hello, Is there a way to gain access to the DatabaseServerLoginModule if I'm running Tomcat and Jboss in two different JVMs. I have done the following: 1. Created a loginServlet that reads the user name and password from the UI 2. Create a new LoginContext("configName" customCallbackHandler); 3. Connect to Jboss using a InitialContext. I would like my LoginContext to use the DatabaseServerLoginModule within the Jboss's JVM so I can get the information needed to do url request validation. Any idea? Thanks all! Claude. [ May 29, 2003: Message edited by: claude jones ]

Hi there, Are you using JAAS? If you are, then before you can use the database module to perform authorization checks on your URL, Tomcat has to authenticate with JBoss as an external client. The recommended way to do this is to use JBoss' CallbackHandler class. Here is how I have implemented it in my application: 1. The following is my custom callback handler class:

2. The following code actually performs the authentication:

Hope this helps. Darryl

claude jones
Greenhorn

Joined: Dec 14, 2001
Posts: 24

posted May 29, 2003 14:45:00

0

The code example is great. I do have one question. I am running Tomcat and Jboss in different JVMs. I have a requirement not to use the JBOSS with embedded Tomcat. If this is the case, when I create the LoginContext:LoginContext loginCtx = new LoginContext ("client-login", handler); And then connect to JBOSS: ... System.setProperty(InitialContext.PROVIDER_URL,"localhost:1099"); ...InitialContext jndiCtx = new InitialContext(); How will the callbackhandler know to pass the user name and password to the login module within JBOSS? This might be a dumb question and I'm missing something. Sorry for the ignorance.

Darryl A. J. Staflund
Ranch Hand

Joined: Oct 06, 2002
Posts: 303

posted May 29, 2003 14:59:00

0

Hi there, I don't have a direct answer because I normally work within the confines of one JVM. I think what you are going to have to do, though, is develop some RMI code in order to perform inter-JVM authentication. Having no JBoss-specific experience with implementing external RMI-based clients, I can only hang my head in shame and say that jboss.org's forums will be a much better resource than me on the matter :-) Darryl