+
+ if (currentAuth == null) {
+ // Pre-auth
+ // TODO Do it at Spring Security level?
+ try {
+ // try to load authentication from session
+ HttpServletRequest httpRequest = RWT.getRequest();
+ HttpSession httpSession = httpRequest.getSession();
+ // log.debug(httpSession.getId());
+ Object contextFromSessionObject = httpSession
+ .getAttribute(SPRING_SECURITY_CONTEXT_KEY);
+ if (contextFromSessionObject != null) {
+ currentAuth = (Authentication) contextFromSessionObject;
+ SecurityContextHolder.getContext().setAuthentication(
+ currentAuth);
+ }
+ } catch (Exception e) {
+ if (log.isTraceEnabled())
+ log.trace("Could not get session", e);
+ // silent
+ }
+ }
+
+ // thread already logged in