从jboss的javax.portlet.PortletSession访问javax.security.auth.Subject

从jboss的javax.portlet.PortletSession访问javax.security.auth.Subject,java,jboss,liferay,portlet,Java,Jboss,Liferay,Portlet,在liferay portlet的呈现阶段,是否有任何方法可以从javax.portlet.PortletSession访问javax.security.auth.Subject? 我已经定义了自定义登录模块,它扩展了com.liferay.portal.security.jaas.ext.jboss.PortalLoginModule。在其中,我可以访问Subject对象,并可以在这里设置主体。现在,我想在部署在jboss中的同一应用程序下的portlet中访问这些主体 我可以通过Portle

在liferay portlet的呈现阶段,是否有任何方法可以从javax.portlet.PortletSession访问javax.security.auth.Subject?

我已经定义了自定义登录模块,它扩展了com.liferay.portal.security.jaas.ext.jboss.PortalLoginModule。在其中,我可以访问Subject对象,并可以在这里设置主体。现在,我想在部署在jboss中的同一应用程序下的portlet中访问这些主体

我可以通过PortletSessionImpl支持的portletSession进行访问,从中我还可以访问HttpSession。这个HttpSession包含subject和其他包含主体的subject,但我找不到任何api或访问它的方法


任何提示都将不胜感激。谢谢你找到了检索主题的方法

import javax.security.auth.Subject;
import javax.security.jacc.PolicyContext;
import java.security.Principal;

Subject currentSubject = (Subject) PolicyContext.getContext("javax.security.auth.Subject.container");
for (Principal principal : currentSubject.getPrincipals()) {
// You have access to individual Principal
}
为我工作:)