aspose file tools*
The moose likes Security and the fly likes JAAS   CallbackHandlers Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Security
Bookmark "JAAS   CallbackHandlers" Watch "JAAS   CallbackHandlers" New topic
Author

JAAS CallbackHandlers

shai koren
Ranch Hand

Joined: Nov 04, 2001
Posts: 48
hello
just a quick question i am not sure about.
Do CallbackHandller implementations have to have a no argument constructor?
It makes sense to me that they dont, because you need a way to pass parameters to populate username/password etc.is that right?
thanks in advance
shai


Shai koren<br />SCJP2 <br />SCEA (well yea only part 1 so far)
Brian Buege
Author
Ranch Hand

Joined: Oct 16, 2002
Posts: 42
Originally posted by shai koren:
hello
just a quick question i am not sure about.
Do CallbackHandller implementations have to have a no argument constructor?
It makes sense to me that they dont, because you need a way to pass parameters to populate username/password etc.is that right?
thanks in advance
shai

Shai-
Super question! JAAS can be confusing in this regard.
Here's a quick answer:
CallbackHandlers must have a no-arg constructor.
The callback handler is responsible for retrieving the uid and password from the user (or other source), so it's hard to pass those items to it at instantiation time... The handle method in the CallbackHandler is called with a particular callback (like PasswordCallback) when the prevailing LoginModule needs to retrieve the password info from the user. Most callback handlers then prompt the user or use some ofhter mechanism to generate this information.
In many cases the callback handler is constructed by the owning app and passed into the constructor for the LoginContext object (thus allowing constructors with arguments to be used). However, the default callback handler for the VM instance can also be specified by setting the auth.login.defaultCallbackHandler system property. If this mechanism is used, then the system will instantiate the callback handler and thus will need a no-arg constructor.
Hope this helps!


Brian Buege<br />Author of <a href="http://www.amazon.com/exec/obidos/ASIN/0072225653/brivacom-20" target="_blank" rel="nofollow">Hacking Exposed J2EE & Java: Developing Secure Web Applications with Java Technology</a><br />Visit the <a href="http://www.hackingexposedjava.com" target="_blank" rel="nofollow">Companion Website</a>
shai koren
Ranch Hand

Joined: Nov 04, 2001
Posts: 48
thanks brian
yep that helped.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JAAS CallbackHandlers