File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Architect Certification (SCEA/OCMJEA) and the fly likes JAAS vs InitialContext authentication Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Architect Certification (SCEA/OCMJEA)
Bookmark "JAAS vs InitialContext authentication" Watch "JAAS vs InitialContext authentication" New topic

JAAS vs InitialContext authentication

Suman Ganta

Joined: Jul 24, 2005
Posts: 18
I got the following question while reading security related stuff (part of scea prep.) I would greatly appriciate if someone can respond with their inputs.

I'm using Weblogic's login module for authentication using JAAS. Is there any difference in authenticating a user using this module and using InitialContext for EJB lookups?
In other words,


What is the difference between statement 1 and statement 2 in terms of authentication? I believe both will do the same kind of authentication.

I've seen a piece of code where in the author is using both of the above statements before looking up for an EJB. Since InitialContext also does the authentication, why do we need to authenticate using JAAS (that uses weblogic's login module) before looking up for an EJB?

chao cai
Ranch Hand

Joined: May 26, 2005
Posts: 154
I think they can both be used with EJB declarative or programatic security.From the viewpoint of EJB tier they are same.

SCEA<br />SCJP 1.2<br />SCBCD<br />MCSD<br />IBM Certified Specialist RUP v2003<br />IBM Certified Solution Designer OOAD vUML2<br /> <br />Phone Number:86-010-82776427
Sanju Thomas
Ranch Hand

Joined: Dec 29, 2004
Posts: 243
If you use some Login Modules, whether it is DatabseLoginModule or any other LoginModules then that is a prewritten Login module, in that sense if you use LoginModule to authenticate then that is declarative security. If you use the second one then what is the use JAAS there ?

So the second one is programtic security and relevant code for authentication is written inside the EJB itself. but in the first case it is written inside the LoginModule and we call that login module thorough picking it up from some XML config files.
Suman Ganta

Joined: Jul 24, 2005
Posts: 18
Thanks Sanju..
Even I felt the same. I don't see any need for the redundant check there. Just wanted to confirm with you people.

I agree. Here's the link:
subject: JAAS vs InitialContext authentication
It's not a secret anymore!