throw new CmsException("Cannot commit", e);
}
- registerSessionAuthorization(request, subject, authorization, locale);
+ // registerSessionAuthorization(request, subject, authorization, locale);
}
private static void checkSubjectEmpty(Subject subject) {
// subject.getPrincipals().removeAll(subject.getPrincipals(AnonymousPrincipal.class));
}
- private synchronized static void registerSessionAuthorization(HttpServletRequest request, Subject subject,
+ synchronized static void registerSessionAuthorization(HttpServletRequest request, Subject subject,
Authorization authorization, Locale locale) {
// synchronized in order to avoid multiple registrations
// TODO move it to a service in order to avoid static synchronization
throw new CmsException("Inconsistent user " + authorization.getName()
+ " for existing CMS session " + cmsSession);
}
+ // keyring
+ subject.getPrivateCredentials().addAll(cmsSession.getSecretKeys());
} else {// anonymous
if (cmsSession.getAuthorization().getName() != null) {
cmsSession.close();
cmsSession = null;
}
}
- }
-
- if (cmsSession == null)
+ } else if (cmsSession == null) {
cmsSession = new WebCmsSessionImpl(subject, authorization, locale, request);
+ }
// request.setAttribute(CmsSession.class.getName(), cmsSession);
CmsSessionId nodeSessionId = new CmsSessionId(cmsSession.getUuid());
if (subject.getPrivateCredentials(CmsSessionId.class).size() == 0)
throw new CmsException(
"Subject already logged with session " + storedSessionId + " (not " + nodeSessionId + ")");
}
- } else {
+ } else
+
+ {
// TODO desktop, CLI
}
}