]> git.argeo.org Git - gpl/argeo-slc.git/blobdiff - cms/org.argeo.cms.integration/src/org/argeo/cms/websocket/CmsWebSocketConfigurator.java
Rename remote auth interfaces
[gpl/argeo-slc.git] / cms / org.argeo.cms.integration / src / org / argeo / cms / websocket / CmsWebSocketConfigurator.java
index 298e8ec27f8d96ca7660c78d041d85d873e39af3..a1cdb257e228a641b4ded6e128a17936f99717fc 100644 (file)
@@ -6,7 +6,6 @@ import java.util.List;
 
 import javax.security.auth.Subject;
 import javax.security.auth.login.LoginContext;
-import javax.servlet.http.HttpSession;
 import javax.websocket.Extension;
 import javax.websocket.HandshakeResponse;
 import javax.websocket.server.HandshakeRequest;
@@ -16,7 +15,9 @@ import javax.websocket.server.ServerEndpointConfig.Configurator;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.argeo.api.NodeConstants;
-import org.argeo.cms.auth.HttpRequestCallbackHandler;
+import org.argeo.cms.auth.RemoteAuthCallbackHandler;
+import org.argeo.cms.auth.RemoteAuthSession;
+import org.argeo.cms.servlet.ServletHttpSession;
 import org.osgi.service.http.context.ServletContextHelper;
 
 /** Customises the initialisation of a new web socket. */
@@ -62,7 +63,8 @@ public class CmsWebSocketConfigurator extends Configurator {
 
        @Override
        public void modifyHandshake(ServerEndpointConfig sec, HandshakeRequest request, HandshakeResponse response) {
-               HttpSession httpSession = (HttpSession) request.getHttpSession();
+
+               RemoteAuthSession httpSession = new ServletHttpSession((javax.servlet.http.HttpSession) request.getHttpSession());
                if (log.isDebugEnabled() && httpSession != null)
                        log.debug("Web socket HTTP session id: " + httpSession.getId());
 
@@ -71,7 +73,7 @@ public class CmsWebSocketConfigurator extends Configurator {
                }
                try {
                        LoginContext lc = new LoginContext(NodeConstants.LOGIN_CONTEXT_USER,
-                                       new HttpRequestCallbackHandler(httpSession));
+                                       new RemoteAuthCallbackHandler(httpSession));
                        lc.login();
                        if (log.isDebugEnabled())
                                log.debug("Web socket logged-in as " + lc.getSubject());
@@ -112,4 +114,3 @@ public class CmsWebSocketConfigurator extends Configurator {
 //     webServerConfig.put(InternalHttpConstants.WEBSOCKET_ENABLED, "true");
 //}
 //}
-