I have a jboss/tomcat web application which is using JAAS forms
authentication for login. Under one set of circumstances, I would like
to be able to log in without prompting the user. My design for this is
to programatically authenticate a fixed user in a non-protected servlet;
my theory was that, with that authentication done, future accesses to
protected resources would succeed thanks to the existing authentication.
Instead, I get redirected to the login page. I know the user I'm
building an authentication for exists and can log in, because I can log
in successfully with that user on the form.
The code I am using looks like this:
LoginContext lc = new LoginContext("userdb", this);
lc.login();
// Debug code
Subject subject = lc.getSubject();
Set subjects = subject.getPrincipals();
Iterator iter = subjects.iterator();
while (iter.hasNext()) {
Logger.debug(this.getClass(), " Subject: " +
(Principal) iter.next());
}
I've omitted the callback handler, but it seems to be working; if I
change the username or password it supplies, I get login failure
exceptions, but with the correct values no exceptions occur. The debug
code produces the following output:
2003-04-02 16:23:51,013 DEBUG GuestLoginDomAdapter- Subject: trial
2003-04-02 16:23:51,013 DEBUG GuestLoginDomAdapter- Subject: Roles
Where 'trial' is the name of my special-case user.
Should the code above be producing an authentication in the environment
which would allow me to access protected content in a realm protected by
domain "userdb"? Or is there something more I have to do to create this
linkage?
Thanks in advance for any help.
--
Craig Berry
Principal Architect and Technical Manager
PortBlue
(310) 566-7546
-------------------------------------------------------
This SF.net email is sponsored by: ValueWeb:
Dedicated Hosting for just $79/mo with 500 GB of bandwidth!
No other company gives more support or power for your dedicated server
http://click.atdmt.com/AFF/go/sdnxxaff00300020aff/direct/01/
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user