我想使用 JSF 创建一个登录表单,该表单还在外部上下文中创建一个新的 UserPrincipal。
当我想在外部 FacesContext 中创建新的 UserPrincipal 时,我必须做什么?
我将 WebSphere Application Server 8 与 JSF 2 结合使用。
我想让这样的东西发挥作用:
FacesContext context = FacesContext.getCurrentInstance();
Principal principal = context.getExternalContext().getUserPrincipal();
致以诚挚的问候 投票
最佳答案
据我所知,我认为我们不必显式创建 UserPrincipal
。您必须使用某种机制(例如 JAAS
/NTLM
/SPNEGO
),以便容器在其 javax.servlet.http.HttpServletRequest
实现中为您创建它
关于java - 如何创建新的 UserPrincipal?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10794237/