Java AS7/Picketbox 4中安全关联的替代方案

Java AS7/Picketbox 4中安全关联的替代方案,java,jboss,seam,kerberos,Java,Jboss,Seam,Kerberos,我在Seam 2应用程序中有以下类,它与SPNEGO一起用于执行Kerberos身份验证。在AS7 Final(使用Pickbox 4.0.0.CR1)中,SecurityAssociation类已被删除。我应该使用哪个类或函数来代替SecurityAssociation.getPrincipal()和SecurityAssociation.getSubject() package com.redhat.topicindex.security; import java.lang.reflec

我在Seam 2应用程序中有以下类,它与SPNEGO一起用于执行Kerberos身份验证。在AS7 Final(使用Pickbox 4.0.0.CR1)中,SecurityAssociation类已被删除。我应该使用哪个类或函数来代替SecurityAssociation.getPrincipal()SecurityAssociation.getSubject()

package com.redhat.topicindex.security;


import java.lang.reflect.Field;


import javax.faces.context.FacesContext;


import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Install;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.annotations.Startup;
import org.jboss.seam.annotations.intercept.BypassInterceptors;
import org.jboss.seam.core.Events;
import org.jboss.seam.security.Identity;
import org.jboss.security.SecurityAssociation;


@SuppressWarnings("serial")
@Name("org.jboss.seam.security.identity")
@Scope(ScopeType.SESSION)
@Install(precedence = Install.DEPLOYMENT)
@BypassInterceptors
@Startup
public class CustomIdentity extends Identity {


          private static final String SUBJECT = "subject";
          private static final String PRINCIPAL = "principal";
          private static final String LOGGED_IN = "loggedIn";


          @Override
          public String login() {

                    if(isLoggedIn()) return LOGGED_IN;

                    try {
                              getCredentials().setUsername(FacesContext.getCurrentInstance().getExternalContext().getRemoteUser());
                              getCredentials().setPassword("");

                              Field field = Identity.class.getDeclaredField(PRINCIPAL);
                              field.setAccessible(true);
                              field.set(this, SecurityAssociation.getPrincipal()); 

                              field = Identity.class.getDeclaredField(SUBJECT);
                              field.setAccessible(true);
                              field.set(this, SecurityAssociation.getSubject());

                              if (Events.exists()) Events.instance().raiseEvent(EVENT_LOGIN_SUCCESSFUL);

                              return LOGGED_IN;
                    } catch (Exception e) {
                              e.printStackTrace();
                              return null;
                    }

          }
}

这一问题的答案如下:

这个补丁对于最新(现在是2015年3月2日)的PicketBox版本(4.0.21.Beta1)似乎不再有效。等效代码如下所示:

SecurityContextAssociation.getSubject();
SecurityContextAssociation.getSubject();