WebSocket authentication
[lgpl/argeo-commons.git] / org.argeo.cms / src / org / argeo / cms / auth / RemoteSessionLoginModule.java
index d801b5e57978aed234b519c0a657e9d2861fd240..6bf3fc985a8d1040edfbab0692a4a4e8cd991dae 100644 (file)
@@ -77,21 +77,23 @@ public class RemoteSessionLoginModule implements LoginModule {
                        authorization = (Authorization) request.getAttribute(RemoteAuthRequest.AUTHORIZATION);
                        if (authorization == null) {// search by session ID
                                RemoteAuthSession httpSession = request.getSession();
-                               if (httpSession == null) {
-                                       // TODO make sure this is always safe
-                                       if (log.isTraceEnabled())
-                                               log.trace("Create http session");
-                                       httpSession = request.createSession();
-                               }
-                               String httpSessionId = httpSession.getId();
+//                             if (httpSession == null) {
+//                                     // TODO make sure this is always safe
+//                                     if (log.isTraceEnabled())
+//                                             log.trace("Create http session");
+//                                     httpSession = request.createSession();
+//                             }
+                               if (httpSession != null) {
+                                       String httpSessionId = httpSession.getId();
 //                             if (log.isTraceEnabled())
 //                                     log.trace("HTTP login: " + request.getPathInfo() + " #" + httpSessionId);
-                               CmsSessionImpl cmsSession = CmsContextImpl.getCmsContext().getCmsSessionByLocalId(httpSessionId);
-                               if (cmsSession != null && !cmsSession.isAnonymous()) {
-                                       authorization = cmsSession.getAuthorization();
-                                       locale = cmsSession.getLocale();
-                                       if (log.isTraceEnabled())
-                                               log.trace("Retrieved authorization from " + cmsSession);
+                                       CmsSessionImpl cmsSession = CmsContextImpl.getCmsContext().getCmsSessionByLocalId(httpSessionId);
+                                       if (cmsSession != null && !cmsSession.isAnonymous()) {
+                                               authorization = cmsSession.getAuthorization();
+                                               locale = cmsSession.getLocale();
+                                               if (log.isTraceEnabled())
+                                                       log.trace("Retrieved authorization from " + cmsSession);
+                                       }
                                }
                        }
                        sharedState.put(CmsAuthUtils.SHARED_STATE_HTTP_REQUEST, request);