"Scott M Stark" <[EMAIL PROTECTED]> wrote:
> On 28 Apr 2001 22:11:18 +0200
> Raffael Herzog <[EMAIL PROTECTED]> wrote:
>
> > > Yes because you are establishing the user identity every time in
> > > each request thread.
> >
> > Just FYI: This did *not* work as expected. I now do the same thing
> > using the "hard" method and it works great -- it's just not as
> > elegant as it could be... :-)
> >
> Can you post the code fragment in the service request handler that
> did the JAAS login? I have done this and it works.
Because it didn't work I didn't check it in and so I don't have it
now. But it must have been something like
StandardCallbackHandler h = new StandardCallbackHandler("tomcat",
"tomcat");
LoginContext ctx = new LoginContext("RequestDispatcherServlet",
h);
ctx.login();
where StandardCallbackHandler is:
public class StandardCallbackHandler implements CallbackHandler {
private String username;
private char[] password;
public StandardCallbackHandler(String username, char[] password) {
this.username = username;
this.password = password;
}
public void handle(Callback[] callbacks)
throws IOException, UnsupportedCallbackException
{
for ( int i=0; i<callbacks.length; i++ ) {
if ( callbacks[i] instanceof NameCallback ) {
((NameCallback)callbacks[i]).setName(username);
}
else if ( callbacks[i] instanceof PasswordCallback ) {
((PasswordCallback)callbacks[i]).setPassword(password);
}
else {
throw new UnsupportedCallbackException(callbacks[i],
"Unrecognized Callback");
}
}
}
}
It's basically exactly the same as I do in the application where it
works. I didn't reconfigure any LoginModules.
--
(o_ Raffael Herzog
//\ [EMAIL PROTECTED]
V_/_
May the penguin be with you!
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user