- private synchronized Session anonymousSession(HttpServletRequest request, Repository repository, String workspace) {
- // TODO rather log in here as anonymous?
- LoginContext lc = (LoginContext) request.getAttribute(NodeConstants.LOGIN_CONTEXT_USER);
- if (lc == null)
- throw new CmsException("No login context available");
- // optimize
- Session session;
- try {
- session = Subject.doAs(lc.getSubject(), new PrivilegedExceptionAction<Session>() {
- @Override
- public Session run() throws Exception {
- return repository.login(workspace);
- }
- });
- } catch (Exception e) {
- throw new CmsException("Cannot log in to JCR", e);
- }
- return session;
- }
+// private synchronized Session anonymousSession(HttpServletRequest request, Repository repository, String workspace) {
+// // TODO rather log in here as anonymous?
+// LoginContext lc = (LoginContext) request.getAttribute(NodeConstants.LOGIN_CONTEXT_ANONYMOUS);
+// if (lc == null)
+// throw new CmsException("No login context available");
+// // optimize
+// Session session;
+// try {
+// session = Subject.doAs(lc.getSubject(), new PrivilegedExceptionAction<Session>() {
+// @Override
+// public Session run() throws Exception {
+// return repository.login(workspace);
+// }
+// });
+// } catch (Exception e) {
+// throw new CmsException("Cannot log in to JCR", e);
+// }
+// return session;
+// }