Uploaded image for project: '[Read Only] - Hippo Site Toolkit 2'
  1. [Read Only] - Hippo Site Toolkit 2
  2. HSTTWO-4669

Cannot cast JCR Sessions created via HST (pooling)repositories to HippoSession

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Normal
    • Resolution: Fixed
    • None
    • 14.0.0
    • None
    • None

    Description

      The HST has two different kind of sessions

      1) PooledSession extends Session which are used in session pools for performance, for example liveuser, previewuser ,etc
      2) LazySession extends Session which can be used in LazyPooling repositories or lazy sessions in non-pooling repository (IIRC)

      Problem is that the HST returns proxies. If for example a website is rendered with subjectbasedsession (session of logged in user), then the following code will break:

      Session session = request.getRequestContext().getSession();
      SessionUser  user = ((HippoSession)session).getUser();
      

      since the proxy can't be cast to SessionUser. Since the jcr session cannot access their own JCR user nodes any more, the user needs to be able to cast to HippoSession. Note that this would work but really shouldn't be needed (and is quite bad that you break out of the proxy so easily)

      Session session = request.getRequestContext().getSession();
      SessionUser  user = ((HippoSession)session.getRootNode.getSession()).getUser();
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            aschrijvers Ard Schrijvers
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: