wood burning stoves 2.0*
The moose likes JBoss/WildFly and the fly likes Getting access to the DatabaseServerLoginModule Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "Getting access to the DatabaseServerLoginModule" Watch "Getting access to the DatabaseServerLoginModule" New topic
Author

Getting access to the DatabaseServerLoginModule

claude jones
Greenhorn

Joined: Dec 14, 2001
Posts: 24
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 ]
Darryl A. J. Staflund
Ranch Hand

Joined: Oct 06, 2002
Posts: 303
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
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
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
claude jones
Greenhorn

Joined: Dec 14, 2001
Posts: 24
Thanks Darryl,
You have been a big help this far!
Take care.
 
GeeCON Prague 2014
 
subject: Getting access to the DatabaseServerLoginModule