Details
-
Bug
-
Status: Closed
-
Normal
-
Resolution: Fixed
-
None
-
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();