1 Reply Latest reply on Nov 20, 2007 5:36 PM by David Pegram

    Obtaining user identity from PortalRuntimeContext?

    David Pegram Newbie

      Hello,

      I'm using JBoss 4.2 EAP and Portal 2.6.2 with JSF and facelets.

      I see in the Reference Guide (Ch. 11) that there is a PortalRuntimeContext. According to the API and the guide, I should be able to get the user's identity via getUserId().

      Unfortunately, I can't figure out how to get the context from within a JSF backing bean.

      Could someone please point me to an example or tutorial?

      Thanks!

        • 1. Re: Obtaining user identity from PortalRuntimeContext?
          David Pegram Newbie

          I may be able to get the information I need another way.

          Unfortunately, the following code fails because the FacesContext is always null.

          FacesContext context = FacesContext.getCurrentInstance();
          PortletRequest request = (PortletRequest)context.getExternalContext().getRequest();
          Principal authenticatedUser = request.getUserPrincipal();
          


          This worked prior to modifying the application to run under the Portal.

          Did I replace/omit a vital part of the configuration from faces-config.xml or web.xml?

          Otherwise, the pages and portlets appear just fine.

          Thanks in advance for any assistance!