Return-Path: X-Original-To: apmail-cloudstack-commits-archive@www.apache.org Delivered-To: apmail-cloudstack-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 56AB4CD62 for ; Tue, 12 Aug 2014 10:34:55 +0000 (UTC) Received: (qmail 62739 invoked by uid 500); 12 Aug 2014 10:34:53 -0000 Delivered-To: apmail-cloudstack-commits-archive@cloudstack.apache.org Received: (qmail 62655 invoked by uid 500); 12 Aug 2014 10:34:53 -0000 Mailing-List: contact commits-help@cloudstack.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cloudstack.apache.org Delivered-To: mailing list commits@cloudstack.apache.org Received: (qmail 62319 invoked by uid 99); 12 Aug 2014 10:34:53 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 12 Aug 2014 10:34:53 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 049138A7427; Tue, 12 Aug 2014 10:34:53 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: bhaisaab@apache.org To: commits@cloudstack.apache.org Date: Tue, 12 Aug 2014 10:35:12 -0000 Message-Id: In-Reply-To: <9602e49732e842f1849b7bb67432733c@git.apache.org> References: <9602e49732e842f1849b7bb67432733c@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [21/28] git commit: updated refs/heads/master to ae207be APIAuthenticator: refactor signature of APIAuthenticator interface's authenticate Pass HttpServletResponse as it can be useful for authenticators which need to have their own writer interface/method Signed-off-by: Rohit Yadav Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/224dc9f8 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/224dc9f8 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/224dc9f8 Branch: refs/heads/master Commit: 224dc9f8e548c222baff92db8b352af46c495ac2 Parents: 6ec1a1b Author: Rohit Yadav Authored: Tue Aug 12 09:15:24 2014 +0200 Committer: Rohit Yadav Committed: Tue Aug 12 12:01:31 2014 +0200 ---------------------------------------------------------------------- server/src/com/cloud/api/ApiServlet.java | 2 +- server/src/com/cloud/api/auth/APIAuthenticator.java | 3 ++- .../src/com/cloud/api/auth/DefaultLoginAPIAuthenticatorCmd.java | 2 +- .../src/com/cloud/api/auth/DefaultLogoutAPIAuthenticatorCmd.java | 3 ++- 4 files changed, 6 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/224dc9f8/server/src/com/cloud/api/ApiServlet.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/api/ApiServlet.java b/server/src/com/cloud/api/ApiServlet.java index d94894a..d09d426 100644 --- a/server/src/com/cloud/api/ApiServlet.java +++ b/server/src/com/cloud/api/ApiServlet.java @@ -178,7 +178,7 @@ public class ApiServlet extends HttpServlet { } try { - responseString = apiAuthenticator.authenticate(command, params, session, remoteAddress, responseType, auditTrailSb); + responseString = apiAuthenticator.authenticate(command, params, session, remoteAddress, responseType, auditTrailSb, resp); } catch (ServerApiException e) { httpResponseCode = e.getErrorCode().getHttpCode(); responseString = e.getMessage(); http://git-wip-us.apache.org/repos/asf/cloudstack/blob/224dc9f8/server/src/com/cloud/api/auth/APIAuthenticator.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/api/auth/APIAuthenticator.java b/server/src/com/cloud/api/auth/APIAuthenticator.java index a0f669e..90cd7ec 100644 --- a/server/src/com/cloud/api/auth/APIAuthenticator.java +++ b/server/src/com/cloud/api/auth/APIAuthenticator.java @@ -18,6 +18,7 @@ package com.cloud.api.auth; import org.apache.cloudstack.api.ServerApiException; +import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import java.util.Map; @@ -34,7 +35,7 @@ import java.util.Map; public interface APIAuthenticator { public String authenticate(String command, Map params, HttpSession session, String remoteAddress, String responseType, - StringBuilder auditTrailSb) throws ServerApiException; + StringBuilder auditTrailSb, final HttpServletResponse resp) throws ServerApiException; public APIAuthenticationType getAPIType(); } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/224dc9f8/server/src/com/cloud/api/auth/DefaultLoginAPIAuthenticatorCmd.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/api/auth/DefaultLoginAPIAuthenticatorCmd.java b/server/src/com/cloud/api/auth/DefaultLoginAPIAuthenticatorCmd.java index 5fa8e9e..fe04ed9 100644 --- a/server/src/com/cloud/api/auth/DefaultLoginAPIAuthenticatorCmd.java +++ b/server/src/com/cloud/api/auth/DefaultLoginAPIAuthenticatorCmd.java @@ -152,7 +152,7 @@ public class DefaultLoginAPIAuthenticatorCmd extends BaseCmd implements APIAuthe } @Override - public String authenticate(String command, Map params, HttpSession session, String remoteAddress, String responseType, StringBuilder auditTrailSb) throws ServerApiException { + public String authenticate(String command, Map params, HttpSession session, String remoteAddress, String responseType, StringBuilder auditTrailSb, final HttpServletResponse resp) throws ServerApiException { // FIXME: ported from ApiServlet, refactor and cleanup final String[] username = (String[])params.get(ApiConstants.USERNAME); http://git-wip-us.apache.org/repos/asf/cloudstack/blob/224dc9f8/server/src/com/cloud/api/auth/DefaultLogoutAPIAuthenticatorCmd.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/api/auth/DefaultLogoutAPIAuthenticatorCmd.java b/server/src/com/cloud/api/auth/DefaultLogoutAPIAuthenticatorCmd.java index ab4e162..a5802bf 100644 --- a/server/src/com/cloud/api/auth/DefaultLogoutAPIAuthenticatorCmd.java +++ b/server/src/com/cloud/api/auth/DefaultLogoutAPIAuthenticatorCmd.java @@ -25,6 +25,7 @@ import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.LogoutCmdResponse; import org.apache.log4j.Logger; +import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import java.util.Map; @@ -55,7 +56,7 @@ public class DefaultLogoutAPIAuthenticatorCmd extends BaseCmd implements APIAuth } @Override - public String authenticate(String command, Map params, HttpSession session, String remoteAddress, String responseType, StringBuilder auditTrailSb) throws ServerApiException { + public String authenticate(String command, Map params, HttpSession session, String remoteAddress, String responseType, StringBuilder auditTrailSb, final HttpServletResponse resp) throws ServerApiException { auditTrailSb.append("=== Logging out ==="); LogoutCmdResponse response = new LogoutCmdResponse(); response.setDescription("success");