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;
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. */
@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());
}
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());
// webServerConfig.put(InternalHttpConstants.WEBSOCKET_ENABLED, "true");
//}
//}
-