[jboss-user] [JBoss Seam] - Re: How to specify a custom CallbackHandler for JAAS
lorenz.fischer
do-not-reply at jboss.com
Fri Sep 7 04:34:03 EDT 2007
Thank you shane!
That's exactly what i found out after doing some more digging in the sourcecode ;) for those being interested in the code that extends the identity:
| package somepackage.security;
|
| import javax.security.auth.callback.CallbackHandler;
|
| import org.jboss.seam.InterceptionType;
| import org.jboss.seam.ScopeType;
| import org.jboss.seam.annotations.Intercept;
| import org.jboss.seam.annotations.Logger;
| import org.jboss.seam.annotations.Name;
| import org.jboss.seam.annotations.Scope;
| import org.jboss.seam.annotations.Startup;
| import org.jboss.seam.log.Log;
| import org.jboss.seam.security.Identity;
|
| /**
| * This class allows us to specify our own CallbackHandler for the JAAS login.
| */
| @Name(value = "org.jboss.seam.security.identity")
| @Scope(ScopeType.SESSION)
| @Intercept(InterceptionType.NEVER)
| @Startup
| public class ConsoleIdentity extends Identity {
|
| @Logger
| private Log log;
|
| /**
| * Supply our own Callbackhandler for the login process
| * @return an instance of ConsoleCallbackHandler
| */
| @Override
| public CallbackHandler getDefaultCallbackHandler() {
| return new ConsoleCallbackHandler(this, log);
| }
|
| }
|
If I got it right its the line
@Name(value = "org.jboss.seam.security.identity")
that does the trick, since this overrides the standard Identity object of Seam?
I used a constructor that lets me pass an identity and a logger, since I couldn't get them over injection in the handler itself.. maybe I'm doing something wrong, but It seems to work like that.
Thank you again.
Cheers
Lorenz
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4081980#4081980
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4081980
More information about the jboss-user
mailing list