Support for separated session per tab and resume Project: http://git-wip-us.apache.org/repos/asf/incubator-wave/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-wave/commit/21d9e825 Tree: http://git-wip-us.apache.org/repos/asf/incubator-wave/tree/21d9e825 Diff: http://git-wip-us.apache.org/repos/asf/incubator-wave/diff/21d9e825
Branch: refs/heads/swellrt Commit: 21d9e82570bb3a16422da1aef2153c5a4c273c37 Parents: 2de6a68 Author: Pablo Ojanguren <[email protected]> Authored: Wed Sep 7 21:38:56 2016 +0200 Committer: Pablo Ojanguren <[email protected]> Committed: Wed Sep 7 21:38:56 2016 +0200 ---------------------------------------------------------------------- .../java/org/swellrt/api/ServiceParameters.java | 3 +- wave/src/main/java/org/swellrt/api/SwellRT.java | 27 ++- .../main/java/org/swellrt/api/WaveClient.java | 8 +- .../java/org/swellrt/api/js/WaveClientJS.java | 18 +- .../box/servlet/AuthenticationService.java | 96 ++++++---- .../server/box/servlet/SwellRtServlet.java | 18 ++ .../server/authentication/SessionManager.java | 36 ++-- .../authentication/SessionManagerImpl.java | 184 ++++++++++++++----- .../box/server/rpc/AuthenticationServlet.java | 2 +- .../box/server/rpc/ServerRpcProvider.java | 7 +- .../server/rpc/AuthenticationServletTest.java | 4 +- 11 files changed, 281 insertions(+), 122 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/21d9e825/wave/src/main/java/org/swellrt/api/ServiceParameters.java ---------------------------------------------------------------------- diff --git a/wave/src/main/java/org/swellrt/api/ServiceParameters.java b/wave/src/main/java/org/swellrt/api/ServiceParameters.java index 9f4bd01..0911e19 100644 --- a/wave/src/main/java/org/swellrt/api/ServiceParameters.java +++ b/wave/src/main/java/org/swellrt/api/ServiceParameters.java @@ -9,6 +9,5 @@ public class ServiceParameters { return JSON.stringify(o); }-*/; - - + } http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/21d9e825/wave/src/main/java/org/swellrt/api/SwellRT.java ---------------------------------------------------------------------- diff --git a/wave/src/main/java/org/swellrt/api/SwellRT.java b/wave/src/main/java/org/swellrt/api/SwellRT.java index bb5d526..20ce0ec 100644 --- a/wave/src/main/java/org/swellrt/api/SwellRT.java +++ b/wave/src/main/java/org/swellrt/api/SwellRT.java @@ -198,7 +198,12 @@ public class SwellRT implements EntryPoint, UnsavedDataListener { final ServiceCallback callback = _callback; - String url = baseServerUrl + "/swell/auth"; + JsoView jsParameters = JsoView.as(parameters); + String participantId = null; + if (jsParameters != null) + participantId = jsParameters.getString("id"); + + String url = baseServerUrl + "/swell/auth/"+(participantId != null ? participantId : ""); RequestBuilder builder = SwellRTUtils.newRequestBuilder(RequestBuilder.POST, url); builder.setHeader("Content-Type", "text/plain; charset=utf-8"); @@ -245,7 +250,7 @@ public class SwellRT implements EntryPoint, UnsavedDataListener { } - public void resume(ServiceCallback _callback) + public void resume(JavaScriptObject parameters, ServiceCallback _callback) throws RequestException { if (_callback == null) @@ -253,7 +258,12 @@ public class SwellRT implements EntryPoint, UnsavedDataListener { final ServiceCallback callback = _callback; - String url = baseServerUrl + "/swell/auth"; + JsoView jsParameters = JsoView.as(parameters); + String participantId = null; + if (jsParameters != null) + participantId = jsParameters.getString("id"); + + String url = baseServerUrl + "/swell/auth/"+(participantId != null ? participantId : ""); url = BrowserSession.addSessionToUrl(url); RequestBuilder builder = SwellRTUtils.newRequestBuilder(RequestBuilder.GET, url); @@ -302,7 +312,7 @@ public class SwellRT implements EntryPoint, UnsavedDataListener { } - public void logout(ServiceCallback _callback) throws RequestException { + public void logout(JavaScriptObject parameters, ServiceCallback _callback) throws RequestException { if (_callback == null) _callback = ServiceCallback.getVoidCallback(); @@ -336,11 +346,16 @@ public class SwellRT implements EntryPoint, UnsavedDataListener { // // Call server to close remote session // + + JsoView jsParameters = JsoView.as(parameters); + String participantId = null; + if (jsParameters != null) + participantId = jsParameters.getString("id"); - String url = baseServerUrl + "/swell/auth"; + String url = baseServerUrl + "/swell/auth/"+ (participantId != null ? participantId : ""); url = BrowserSession.addSessionToUrl(url); - RequestBuilder builder = SwellRTUtils.newRequestBuilder(RequestBuilder.POST, url); + RequestBuilder builder = SwellRTUtils.newRequestBuilder(RequestBuilder.DELETE, url); builder.setHeader("Content-Type", "text/plain; charset=utf-8"); builder.sendRequest("{}", new RequestCallback() { http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/21d9e825/wave/src/main/java/org/swellrt/api/WaveClient.java ---------------------------------------------------------------------- diff --git a/wave/src/main/java/org/swellrt/api/WaveClient.java b/wave/src/main/java/org/swellrt/api/WaveClient.java index a9ea73e..c685fbe 100644 --- a/wave/src/main/java/org/swellrt/api/WaveClient.java +++ b/wave/src/main/java/org/swellrt/api/WaveClient.java @@ -129,15 +129,15 @@ public class WaveClient implements SwellRT.Listener { coreClient.login(parameters, onComplete); } - public void resume(ServiceCallback onComplete) + public void resume(JavaScriptObject parameters, ServiceCallback onComplete) throws RequestException { - coreClient.resume(onComplete); + coreClient.resume(parameters, onComplete); } - public void logout(ServiceCallback onComplete) + public void logout(JavaScriptObject parameters, ServiceCallback onComplete) throws RequestException { - coreClient.logout(onComplete); + coreClient.logout(parameters, onComplete); } public void open(JavaScriptObject parameters, ServiceCallback onComplete) throws RequestException { http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/21d9e825/wave/src/main/java/org/swellrt/api/js/WaveClientJS.java ---------------------------------------------------------------------- diff --git a/wave/src/main/java/org/swellrt/api/js/WaveClientJS.java b/wave/src/main/java/org/swellrt/api/js/WaveClientJS.java index c338901..322cc48 100644 --- a/wave/src/main/java/org/swellrt/api/js/WaveClientJS.java +++ b/wave/src/main/java/org/swellrt/api/js/WaveClientJS.java @@ -219,20 +219,30 @@ public class WaveClientJS extends JavaScriptObject { }, - resume: function(onComplete) { + resume: function(parameters, onComplete) { + + if (!onComplete) { + onComplete = parameters; + parameters = "{}"; + } try { - return [email protected]::resume(Lorg/swellrt/api/ServiceCallback;)(onComplete); + return [email protected]::resume(Lcom/google/gwt/core/client/JavaScriptObject;Lorg/swellrt/api/ServiceCallback;)(parameters, onComplete); } catch (e) { throw @org.swellrt.api.WaveClient::wrapJavaException(Ljava/lang/Object;)(e); } }, - logout: function(onComplete) { + logout: function(parameters, onComplete) { + + if (!onComplete) { + onComplete = parameters; + parameters = "{}"; + } try { - return [email protected]::logout(Lorg/swellrt/api/ServiceCallback;)(onComplete); + return [email protected]::logout(Lcom/google/gwt/core/client/JavaScriptObject;Lorg/swellrt/api/ServiceCallback;)(parameters, onComplete); } catch (e) { throw @org.swellrt.api.WaveClient::wrapJavaException(Ljava/lang/Object;)(e); } http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/21d9e825/wave/src/main/java/org/swellrt/server/box/servlet/AuthenticationService.java ---------------------------------------------------------------------- diff --git a/wave/src/main/java/org/swellrt/server/box/servlet/AuthenticationService.java b/wave/src/main/java/org/swellrt/server/box/servlet/AuthenticationService.java index 14d0370..8650411 100644 --- a/wave/src/main/java/org/swellrt/server/box/servlet/AuthenticationService.java +++ b/wave/src/main/java/org/swellrt/server/box/servlet/AuthenticationService.java @@ -123,6 +123,8 @@ public class AuthenticationService extends BaseService { doPost(request, response); else if (request.getMethod().equals("GET")) doGet(request, response); + else if (request.getMethod().equals("DELETE")) + doDelete(request, response); } catch (PersistenceException e) { sendResponseError(response, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, @@ -229,37 +231,14 @@ public class AuthenticationService extends BaseService { loggedInAddress = ParticipantId.anonymousOfUnsafe(session.getId(), domain); } - - - } else if (!authData.isParsedField("id") || !authData.isParsedField("password")) { - // Nothing to do here, close session later } else { sendResponseError(resp, HttpServletResponse.SC_BAD_REQUEST, RC_MISSING_PARAMETER); return; } - - } - // If we have reach this point with a no login, close current session - if (loggedInAddress == null) { - - try { - session = sessionManager.getSession(req); - LOG.info("Closing session " + (session != null ? session.getId() : "")); - sessionManager.logout(session); - if (context != null) - context.logout(); - } catch (LoginException e) { - LOG.info("An error ocurred during logout request", e); - } - - sendResponse(resp, new AuthenticationServiceData("SESSION_CLOSED")); - return; - - } - - sessionManager.setLoggedInUser(session, loggedInAddress); + + sessionManager.login(session, loggedInAddress); LOG.info("Authenticated user " + loggedInAddress); AccountService.AccountServiceData accountData; @@ -279,6 +258,45 @@ public class AuthenticationService extends BaseService { } /** + * DELETE a session + * + * @param req + * @param resp + * @throws IOException + */ + protected void doDelete(HttpServletRequest req, HttpServletResponse resp) throws IOException { + + String[] pathTokens = SwellRtServlet.getCleanPathInfo(req).split("/"); + String participantToken = pathTokens.length > 2 ? pathTokens[2] : null; + + HttpSession session = sessionManager.getSession(req); + + boolean wasDelete = false; + + if (participantToken != null && !participantToken.isEmpty()) { + ParticipantId participantId; + try { + participantId = ParticipantId.of(participantToken); + } catch (InvalidParticipantAddress e) { + sendResponseError(resp, HttpServletResponse.SC_BAD_REQUEST, RC_INVALID_ACCOUNT_ID_SYNTAX); + return; + } + wasDelete = sessionManager.logout(session, participantId); + } else { + wasDelete = sessionManager.logout(session); + } + + if (wasDelete) { + sendResponse(resp, new AuthenticationServiceData("SESSION_CLOSED")); + return; + } else { + sendResponseError(resp, HttpServletResponse.SC_BAD_REQUEST, RC_ACCOUNT_NOT_LOGGED_IN); + return; + } + +} + + /** * Get the participant id of the given subject. * * The subject is searched for compatible principals. When other @@ -381,19 +399,23 @@ public class AuthenticationService extends BaseService { */ protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException, PersistenceException { - // If the user is already logged in, we'll try to redirect them immediately. - resp.setCharacterEncoding("UTF-8"); - req.setCharacterEncoding("UTF-8"); - - HttpSession session = sessionManager.getSession(req, false); - ParticipantId participantId = sessionManager.getLoggedInUser(req); - // Resume last user session from other browser's tab or window. - if (participantId == null && session != null) { - participantId = sessionManager.getOtherLoggedInUser(session); - if (participantId != null) sessionManager.setLoggedInUser(session, participantId); - } + String[] pathTokens = SwellRtServlet.getCleanPathInfo(req).split("/"); + String participantToken = pathTokens.length > 2 ? pathTokens[2] : null; + + ParticipantId participantId = null; + if (participantToken != null && !participantToken.isEmpty()) { + try { + participantId = ParticipantId.of(participantToken); + } catch (InvalidParticipantAddress e) { + sendResponseError(resp, HttpServletResponse.SC_BAD_REQUEST, RC_INVALID_ACCOUNT_ID_SYNTAX); + return; + } + } + + participantId = sessionManager.resume(participantId, req); + if (participantId != null) { AccountService.AccountServiceData accountData; @@ -432,7 +454,7 @@ public class AuthenticationService extends BaseService { StringWriter writer = new StringWriter(); IOUtils.copy(request.getInputStream(), writer, Charset.forName("UTF-8")); - + String json = writer.toString(); if (json == null) http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/21d9e825/wave/src/main/java/org/swellrt/server/box/servlet/SwellRtServlet.java ---------------------------------------------------------------------- diff --git a/wave/src/main/java/org/swellrt/server/box/servlet/SwellRtServlet.java b/wave/src/main/java/org/swellrt/server/box/servlet/SwellRtServlet.java index 8c49e62..72100c8 100644 --- a/wave/src/main/java/org/swellrt/server/box/servlet/SwellRtServlet.java +++ b/wave/src/main/java/org/swellrt/server/box/servlet/SwellRtServlet.java @@ -148,6 +148,24 @@ public class SwellRtServlet extends HttpServlet { } + } + + @Override + protected void doDelete(HttpServletRequest req, HttpServletResponse response) throws IOException { + + String[] pathTokens = getCleanPathInfo(req).split("/"); + String entity = pathTokens[1]; + + if (entity.equals("auth")) { + + injector.getInstance(AuthenticationService.class).execute(req, response); + } else { + + response.sendError(HttpServletResponse.SC_BAD_REQUEST); + return; + + } + } } http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/21d9e825/wave/src/main/java/org/waveprotocol/box/server/authentication/SessionManager.java ---------------------------------------------------------------------- diff --git a/wave/src/main/java/org/waveprotocol/box/server/authentication/SessionManager.java b/wave/src/main/java/org/waveprotocol/box/server/authentication/SessionManager.java index 57a2e06..5d3d4bc 100644 --- a/wave/src/main/java/org/waveprotocol/box/server/authentication/SessionManager.java +++ b/wave/src/main/java/org/waveprotocol/box/server/authentication/SessionManager.java @@ -77,7 +77,7 @@ public interface SessionManager { * request.getSession(true); * @param id the user who has been logged in */ - void setLoggedInUser(HttpSession session, ParticipantId id); + void login(HttpSession session, ParticipantId id); /** * Log the user out. @@ -87,7 +87,28 @@ public interface SessionManager { * @param session The user's HTTP session, obtainable from * request.getSession(false); */ - void logout(HttpSession session); + boolean logout(HttpSession session); + + /** + * Log the user out. + * + * If session is null, this function has no effect. + * + * @param session The user's HTTP session, obtainable from + * request.getSession(false); + * @param participant to be log out + */ + boolean logout(HttpSession session, ParticipantId id); + + /** + * Resume a session, with the last user log in any + * window session or with specific one + * + * @param request + * @param participant, a + * @return the participant or null + */ + ParticipantId resume(ParticipantId participant, HttpServletRequest request); /** * Get the relative URL to redirect the user to the login page. @@ -130,7 +151,7 @@ public interface SessionManager { /** - * A convinience method to extract the logged in participant from the request + * A convenience method to extract the logged in participant from the request * in only one step. * * @param request @@ -147,13 +168,4 @@ public interface SessionManager { */ Set<ParticipantId> getAllLoggedInUser(HttpSession session); - /** - * Return the last user who has opened a session on the browser. - * - * @param session - * @return - */ - ParticipantId getOtherLoggedInUser(HttpSession session); - - } http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/21d9e825/wave/src/main/java/org/waveprotocol/box/server/authentication/SessionManagerImpl.java ---------------------------------------------------------------------- diff --git a/wave/src/main/java/org/waveprotocol/box/server/authentication/SessionManagerImpl.java b/wave/src/main/java/org/waveprotocol/box/server/authentication/SessionManagerImpl.java index fe7622f..afef904 100644 --- a/wave/src/main/java/org/waveprotocol/box/server/authentication/SessionManagerImpl.java +++ b/wave/src/main/java/org/waveprotocol/box/server/authentication/SessionManagerImpl.java @@ -23,6 +23,7 @@ import com.google.common.base.Preconditions; import com.google.common.base.Strings; import com.google.inject.Inject; +import org.eclipse.jetty.security.authentication.LoginAuthenticator; import org.waveprotocol.box.server.account.AccountData; import org.waveprotocol.box.server.account.HumanAccountDataImpl; import org.waveprotocol.box.server.persistence.AccountStore; @@ -106,7 +107,7 @@ public final class SessionManagerImpl implements SessionManager { } @Override - public void setLoggedInUser(HttpSession session, ParticipantId id) { + public void login(HttpSession session, ParticipantId id) { Preconditions.checkNotNull(session, "Session is null"); Preconditions.checkNotNull(id, "Participant id is null"); @@ -123,21 +124,140 @@ public final class SessionManagerImpl implements SessionManager { } @Override - public void logout(HttpSession session) { - String windowId = null; - if (session instanceof HttpWindowSession) { - HttpWindowSession wSession = (HttpWindowSession) session; - windowId = wSession.getWindowId(); + public boolean logout(HttpSession session) { + + // Remove all window sessions + Enumeration<String> attributes = session.getAttributeNames(); + + while (attributes.hasMoreElements()) { + String attr = attributes.nextElement(); + if (attr.startsWith(USER_FIELD)); { + session.removeAttribute(attr); } - - // This function should also remove any other bound fields in the session - // object. - if (windowId != null) - session.removeAttribute(USER_FIELD + "_" + windowId); - else - session.removeAttribute(USER_FIELD); + } + + return true; + } + + @Override + public boolean logout(HttpSession session, ParticipantId id) { + + // remove all attributes storing window sessions + + boolean wasDeleted = false; + + String windowId = null; + if (session instanceof HttpWindowSession) { + HttpWindowSession wSession = (HttpWindowSession) session; + windowId = wSession.getWindowId(); + } + + if (windowId != null) { + // Remove all window sessions with this user + Enumeration<String> attributes = session.getAttributeNames(); - session.invalidate(); + while (attributes.hasMoreElements()) { + String attr = attributes.nextElement(); + if (attr.startsWith(USER_FIELD)) { + ParticipantId participantIdAttr = (ParticipantId) session.getAttribute(attr); + if (participantIdAttr != null && participantIdAttr.equals(id)) { + session.removeAttribute(attr); + wasDeleted = true; + } + } + } + + } else { + // Remove the session if user is in attribute + Object userAttrObject = session.getAttribute(USER_FIELD); + if (userAttrObject != null) { + ParticipantId participantIdAttr = (ParticipantId) userAttrObject; + if (participantIdAttr != null && participantIdAttr.equals(id)) { + session.removeAttribute(USER_FIELD); + wasDeleted = true; + } + } + + } + return wasDeleted; + } + + @Override + public ParticipantId resume(ParticipantId participant, HttpServletRequest request) { + + // if participant is null, + // check for previous window session + // or + // resume with the last log in participant + // + // if participant no null, resume with her if it has an open session + + HttpSession session = getSession(request); + + if (session == null) return null; + + + String windowId = null; + if (session instanceof HttpWindowSession) { + HttpWindowSession wSession = (HttpWindowSession) session; + windowId = wSession.getWindowId(); + } + + if (participant == null && windowId != null) { + Object o = session.getAttribute(USER_FIELD+"_"+windowId); + if (o != null) { + login(session, (ParticipantId) o); + return (ParticipantId) o; + } + } + + + ParticipantId matchedParticipant = null; + int matchedParticipantIndex = -1; + Enumeration<String> names = session.getAttributeNames(); + + // Found the last participant among all the session attributes + while (names.hasMoreElements()) { + String name = names.nextElement(); + if (name.startsWith(USER_FIELD)) { + if (name.contains(USER_FIELD + "_")) { + + int index = Integer.valueOf(name.split("_")[1]); + + if (index > matchedParticipantIndex) { + matchedParticipantIndex = index; + matchedParticipant = (ParticipantId) session.getAttribute(name); + if (participant != null && matchedParticipant.equals(participant)) { + break; + } + } + + } else { + + if (matchedParticipantIndex < 0) { + matchedParticipantIndex = 0; + matchedParticipant = (ParticipantId) session.getAttribute(name); + if (participant != null && matchedParticipant.equals(participant)) { + break; + } + } + + } + } + } + + if (participant != null) { + if (matchedParticipant != null && matchedParticipant.equals(participant)) { + login(session, matchedParticipant); + return participant; + } else + return null; + } + + if (matchedParticipant != null) + login(session, matchedParticipant); + + return matchedParticipant; } @Override @@ -210,40 +330,4 @@ public final class SessionManagerImpl implements SessionManager { return participants; } - - @Override - public ParticipantId getOtherLoggedInUser(HttpSession session) { - - if (session == null) return null; - - ParticipantId lastParticipant = null; - int lastParticipantIndex = -1; - Enumeration<String> names = session.getAttributeNames(); - - // Found the last participant among all the session attributes - while (names.hasMoreElements()) { - String name = names.nextElement(); - if (name.contains(USER_FIELD)) { - if (name.contains(USER_FIELD + "_")) { - - int index = Integer.valueOf(name.split("_")[1]); - - if (index > lastParticipantIndex) { - lastParticipantIndex = index; - lastParticipant = (ParticipantId) session.getAttribute(name); - } - - } else { - - if (lastParticipantIndex < 0) { - lastParticipantIndex = 0; - lastParticipant = (ParticipantId) session.getAttribute(name); - } - - } - } - } - - return lastParticipant; - } } http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/21d9e825/wave/src/main/java/org/waveprotocol/box/server/rpc/AuthenticationServlet.java ---------------------------------------------------------------------- diff --git a/wave/src/main/java/org/waveprotocol/box/server/rpc/AuthenticationServlet.java b/wave/src/main/java/org/waveprotocol/box/server/rpc/AuthenticationServlet.java index 353f544..0603982 100644 --- a/wave/src/main/java/org/waveprotocol/box/server/rpc/AuthenticationServlet.java +++ b/wave/src/main/java/org/waveprotocol/box/server/rpc/AuthenticationServlet.java @@ -251,7 +251,7 @@ public class AuthenticationServlet extends HttpServlet { loggedInAddress = ParticipantId.anonymousOfUnsafe(session.getId(), domain); } - sessionManager.setLoggedInUser(session, loggedInAddress); + sessionManager.login(session, loggedInAddress); LOG.info("Authenticated user " + loggedInAddress); if (checkNoRedirect(req)) { http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/21d9e825/wave/src/main/java/org/waveprotocol/box/server/rpc/ServerRpcProvider.java ---------------------------------------------------------------------- diff --git a/wave/src/main/java/org/waveprotocol/box/server/rpc/ServerRpcProvider.java b/wave/src/main/java/org/waveprotocol/box/server/rpc/ServerRpcProvider.java index 508fb3e..77b6cbf 100755 --- a/wave/src/main/java/org/waveprotocol/box/server/rpc/ServerRpcProvider.java +++ b/wave/src/main/java/org/waveprotocol/box/server/rpc/ServerRpcProvider.java @@ -595,12 +595,11 @@ public class ServerRpcProvider { context.setInitParameter("org.eclipse.jetty.servlet.MaxAge", String.valueOf(Integer.MAX_VALUE)); else context.setInitParameter("org.eclipse.jetty.servlet.MaxAge", String.valueOf(sessionCookieMaxAge)); - FilterHolder corsFilterHolder = new FilterHolder(CrossOriginFilter.class); - corsFilterHolder.setInitParameter("allowedOrigins", "*"); + corsFilterHolder.setInitParameter(CrossOriginFilter.ALLOWED_ORIGINS_PARAM, "*"); // Set explicit methods to allow CORS with DELETE - corsFilterHolder.setInitParameter("allowedMethods", "GET,POST,DELETE,PUT,HEAD"); - corsFilterHolder.setInitParameter("allowedHeaders", + corsFilterHolder.setInitParameter(CrossOriginFilter.ALLOWED_METHODS_PARAM, "GET,POST,DELETE,PUT,HEAD"); + corsFilterHolder.setInitParameter(CrossOriginFilter.ALLOWED_HEADERS_PARAM, "X-Requested-With,Content-Type,Accept,Origin,X-window-id"); context.addFilter(corsFilterHolder, "/*", EnumSet.allOf(DispatcherType.class)); http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/21d9e825/wave/src/test/java/org/waveprotocol/box/server/rpc/AuthenticationServletTest.java ---------------------------------------------------------------------- diff --git a/wave/src/test/java/org/waveprotocol/box/server/rpc/AuthenticationServletTest.java b/wave/src/test/java/org/waveprotocol/box/server/rpc/AuthenticationServletTest.java index cd64ca9..848954a 100644 --- a/wave/src/test/java/org/waveprotocol/box/server/rpc/AuthenticationServletTest.java +++ b/wave/src/test/java/org/waveprotocol/box/server/rpc/AuthenticationServletTest.java @@ -216,9 +216,9 @@ public class AuthenticationServletTest extends TestCase { servlet.doPost(req, resp); if (expectSuccess) { if (ParticipantId.isAnonymousName(address)) - verify(manager).setLoggedInUser(session, ANONYMOUS_USER); + verify(manager).login(session, ANONYMOUS_USER); else - verify(manager).setLoggedInUser(session, USER); + verify(manager).login(session, USER); } } }
