Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » JBoss User Help »

[jboss-user] [JBoss Seam] - Identity not created

scott.stark@jboss.org

2007-07-19


I'm attempting to override Identity to add some logic specific to our application. Namely:

We're are replacing an old application and need check the previous applications login cookie value when the Seam cookie isn't found.
We need the getLoginFailedMessageSeverity() to return SEVERITY_ERROR instead of SEVERITY_INFO.
And a couple other little things.

But when I use @In Identity identity, elsewhere in my application, it's always null. What else do I need to do to get Seam to recognize it? Do I need to specify @AutoCreate? An instance() method in the subclass?

@Name("org.jboss.seam.security.identity")
| @Scope(ScopeType.SESSION)
| @Intercept(InterceptionType.AFTER_RESTORE_VIEW)
| @Startup
| @Install(precedence=11) //Used 11 to override RuleBasedIdentity
| public class Identity extends org.jboss.seam.security.Identity {
|  
|   private static final LogProvider log = Logging.getLogProvider(Identity.class);
|
|   @Override
|   protected Severity getLoginFailedMessageSeverity() {
|      return FacesMessage.SEVERITY_ERROR;
|   }
|
|   protected String getLegacyCookieName() {
|      return "userCookie";
|   }
|
|   @Override
|   protected Cookie getCookie() {
|      FacesContext ctx = FacesContext.getCurrentInstance();
|      if (ctx != null) {
|         Cookie cookie = (Cookie) ctx.
|           getExternalContext().getRequestCookieMap().get(getCookieName());
|         return cookie != null ? cookie : getLegacyCookie();
|      } else {
|         return null;
|      }
|   }
|
|   protected Cookie getLegacyCookie() {
|      log.debug("NEM4 Cookie not found. Attempting to load legacy cookie.");
|      FacesContext ctx = FacesContext.getCurrentInstance();
|      return (Cookie) ctx.getExternalContext().getRequestCookieMap().get(getLegacyCookieName());
|   }
|
|   public void create() {
|      super.create();
|      log.debug("Creating custom Identity.");
|   }
|
|   @Override
|   protected String getLoginFailedMessageKey() {
|      log.debug("Retrieving login failed message.");
|      return "login.error.userNamePassword";
|   }
| }
|

What am I doing wrong? Thanks

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4065657#4065657

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4065657
_______________________________________________
jboss-user mailing list
jboss-user@(protected)
https://lists.jboss.org/mailman/listinfo/jboss-user
©2008 junlu.com - Jax Systems, LLC, U.S.A.