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 BAF4811788 for ; Mon, 25 Aug 2014 00:01:13 +0000 (UTC) Received: (qmail 57164 invoked by uid 500); 25 Aug 2014 00:01:13 -0000 Delivered-To: apmail-cloudstack-commits-archive@cloudstack.apache.org Received: (qmail 57134 invoked by uid 500); 25 Aug 2014 00:01:13 -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 57125 invoked by uid 99); 25 Aug 2014 00:01:13 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 25 Aug 2014 00:01:13 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 45B679CB8D0; Mon, 25 Aug 2014 00:01:13 +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 Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: git commit: updated refs/heads/saml2 to 67cfb56 Date: Mon, 25 Aug 2014 00:01:13 +0000 (UTC) Repository: cloudstack Updated Branches: refs/heads/saml2 24b43f818 -> 67cfb568e (forced update) saml: use SAML_RESPONSE from SAMLUtils 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/67cfb568 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/67cfb568 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/67cfb568 Branch: refs/heads/saml2 Commit: 67cfb568e1079a8e3453bbbef1518a6480e970ec Parents: fa0d81b Author: Rohit Yadav Authored: Mon Aug 25 01:58:24 2014 +0200 Committer: Rohit Yadav Committed: Mon Aug 25 02:00:41 2014 +0200 ---------------------------------------------------------------------- .../api/command/SAML2LoginAPIAuthenticatorCmd.java | 8 +++----- utils/src/org/apache/cloudstack/utils/auth/SAMLUtils.java | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/67cfb568/plugins/user-authenticators/saml2/src/org/apache/cloudstack/api/command/SAML2LoginAPIAuthenticatorCmd.java ---------------------------------------------------------------------- diff --git a/plugins/user-authenticators/saml2/src/org/apache/cloudstack/api/command/SAML2LoginAPIAuthenticatorCmd.java b/plugins/user-authenticators/saml2/src/org/apache/cloudstack/api/command/SAML2LoginAPIAuthenticatorCmd.java index 8456872..6c46b04 100644 --- a/plugins/user-authenticators/saml2/src/org/apache/cloudstack/api/command/SAML2LoginAPIAuthenticatorCmd.java +++ b/plugins/user-authenticators/saml2/src/org/apache/cloudstack/api/command/SAML2LoginAPIAuthenticatorCmd.java @@ -67,9 +67,7 @@ import javax.servlet.http.HttpSession; import javax.xml.parsers.ParserConfigurationException; import javax.xml.stream.FactoryConfigurationError; import java.io.IOException; -import java.math.BigInteger; import java.net.URLEncoder; -import java.security.SecureRandom; import java.util.List; import java.util.Map; @@ -123,7 +121,7 @@ public class SAML2LoginAPIAuthenticatorCmd extends BaseCmd implements APIAuthent throw new ServerApiException(ApiErrorCode.METHOD_NOT_ALLOWED, "This is an authentication api, cannot be used directly"); } - public String buildAuthnRequestUrl(String idpUrl) { + private String buildAuthnRequestUrl(String idpUrl) { String spId = _samlAuthManager.getServiceProviderId(); String consumerUrl = _samlAuthManager.getSpSingleSignOnUrl(); String identityProviderUrl = _samlAuthManager.getIdpSingleSignOnUrl(); @@ -143,7 +141,7 @@ public class SAML2LoginAPIAuthenticatorCmd extends BaseCmd implements APIAuthent return redirectUrl; } - public Response processSAMLResponse(String responseMessage) { + private Response processSAMLResponse(String responseMessage) { Response responseObject = null; try { DefaultBootstrap.bootstrap(); @@ -168,7 +166,7 @@ public class SAML2LoginAPIAuthenticatorCmd extends BaseCmd implements APIAuthent resp.sendRedirect(redirectUrl); return ""; } else { - final String samlResponse = ((String[])params.get("SAMLResponse"))[0]; + final String samlResponse = ((String[])params.get(SAMLUtils.SAML_RESPONSE))[0]; Response processedSAMLResponse = processSAMLResponse(samlResponse); String statusCode = processedSAMLResponse.getStatus().getStatusCode().getValue(); if (!statusCode.equals(StatusCode.SUCCESS_URI)) { http://git-wip-us.apache.org/repos/asf/cloudstack/blob/67cfb568/utils/src/org/apache/cloudstack/utils/auth/SAMLUtils.java ---------------------------------------------------------------------- diff --git a/utils/src/org/apache/cloudstack/utils/auth/SAMLUtils.java b/utils/src/org/apache/cloudstack/utils/auth/SAMLUtils.java index 9eafe55..a238c82 100644 --- a/utils/src/org/apache/cloudstack/utils/auth/SAMLUtils.java +++ b/utils/src/org/apache/cloudstack/utils/auth/SAMLUtils.java @@ -72,10 +72,10 @@ import java.util.zip.DeflaterOutputStream; public class SAMLUtils { public static final Logger s_logger = Logger.getLogger(SAMLUtils.class); + public static final String SAML_RESPONSE = "SAMLResponse"; public static final String SAML_NS = "saml://"; public static final String SAML_NAMEID = "SAML_NAMEID"; public static final String SAML_SESSION = "SAML_SESSION"; - public static final String CERTIFICATE_NAME = "SAMLSP_CERTIFICATE"; public static String createSAMLId(String uid) {