From 9f43376c0d95f4c48306325202f0b27e390d2242 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20P=C3=A4rtel?= Date: Mon, 24 Sep 2012 05:42:25 +0300 Subject: [PATCH] Auth request parameter name "sessionId" -> "session_id". --- .../helsinki/cs/tmc/comet/acl/TmcSecurityPolicy.java | 2 +- .../fi/helsinki/cs/tmc/comet/StubAuthServer.java | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/main/java/fi/helsinki/cs/tmc/comet/acl/TmcSecurityPolicy.java b/src/main/java/fi/helsinki/cs/tmc/comet/acl/TmcSecurityPolicy.java index a7f9ae2..ac5806d 100644 --- a/src/main/java/fi/helsinki/cs/tmc/comet/acl/TmcSecurityPolicy.java +++ b/src/main/java/fi/helsinki/cs/tmc/comet/acl/TmcSecurityPolicy.java @@ -99,7 +99,7 @@ private boolean authenticateFrontend(String serverBaseUrl, String username, Stri if (password != null) { data += "&password=" + Resty.enc(password); } else { - data += "&sessionId=" + Resty.enc(sessionId); + data += "&session_id=" + Resty.enc(sessionId); } FormContent formContent = Resty.form(data); String response = new Resty().text(authUrl, formContent).toString().trim(); diff --git a/src/test/java/fi/helsinki/cs/tmc/comet/StubAuthServer.java b/src/test/java/fi/helsinki/cs/tmc/comet/StubAuthServer.java index 6b3d18b..f6fc842 100644 --- a/src/test/java/fi/helsinki/cs/tmc/comet/StubAuthServer.java +++ b/src/test/java/fi/helsinki/cs/tmc/comet/StubAuthServer.java @@ -95,10 +95,14 @@ public void handle(String target, Request baseRequest, HttpServletRequest reques if (baseRequest.getPathInfo() != null && pathInfo.equals("/foo/auth.text")) { boolean userOk = false; - if (request.getParameter("password") != null) { - userOk = userExists(request.getParameter("username"), request.getParameter("password")); - } else if (request.getParameter("sessionId") != null) { - userOk = sessionIsValid(request.getParameter("username"), request.getParameter("sessionId")); + String username = request.getParameter("username"); + String password = request.getParameter("password"); + String sessionId = request.getParameter("session_id"); + + if (password != null) { + userOk = userExists(username, password); + } else if (sessionId != null) { + userOk = sessionIsValid(username, sessionId); } response.setContentType("text/plain; charset=utf-8");