JGH <johnheim@nospam.tds.net> said:
>> JGH <johnheim@nospam.tds.net> said:
>>>I added a Realm tag to my tomcat server.xml file. Shouldn't that
[quoted text clipped - 8 lines]
>Thanks. The documentation on the apache web site just ended after
>explaining how to create a realm.
This problem appears to be common across J2EE app.servers; (some days
ago I helped a friend to pick together pieces of the J2EE login process
for BEA WebLogic).
I think this comes from the multiplicity of different developer roles
Sun has assigned for J2EE development process. Creating the realm is
one part of the game -- and this is documented in the server
administration guides (and is different for each type of server).
The other part is writing the application to utilise the realm
(and this is independent of the server).
>Actually, I think it's wrong in that it says you have to modify the
>server.xml file and that's not true in tomcat 5+. There's an xml file
>for each context and you can add it there.
You're right.
>Below is my web.xml and my login.jsp
>
[quoted text clipped - 19 lines]
> </form-login-config>
> </login-config>
Ok, I think there's one piece missing here. You should also have:
<!-- Security roles referenced by this web application -->
<security-role>
<description>
Blabla
</description>
<role-name>tpusers</role-name>
</security-role>
... to declare all the security roles that your application uses.
Other than that, I don't see a problem. Note that the ordering of elements
within web.xml makes a difference; the order for the above three
elements must be security-constraint,login-config,security-role .
Crosscheck what you have with either Tomcat admin webapp, or
the authentication example from the Tomcat example webapp.

Signature
Wolf a.k.a. Juha Laiho Espoo, Finland
(GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V
PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
"...cancel my subscription to the resurrection!" (Jim Morrison)
techguy_chicago@yahoo.com - 20 Apr 2005 02:17 GMT
why does Tomcat need to know what the roles are, anyways? is that a
J2EE spec or something? having to hardcode those values into a web.xml
file seems to defeat part of the purpose of using a database in the
first place - flexibility. but since most of the Tomcat devs are
smarter than me, I want to know why, b/c apparently more than a few
people thought it was a good idea...