From fecc6b6e48a623197053a66758071b86fbf3fef1 Mon Sep 17 00:00:00 2001 From: Rohit Yadav Date: Fri, 12 Sep 2014 16:47:40 +0200 Subject: [PATCH] SAML2LoginAPIAuthenticatorCmd: Don't support HTTP artifact binding Signed-off-by: Rohit Yadav --- .../api/command/SAML2LoginAPIAuthenticatorCmd.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 0257ecfe9d1..0f316a8a763 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 @@ -162,7 +162,7 @@ public class SAML2LoginAPIAuthenticatorCmd extends BaseCmd implements APIAuthent @Override public String authenticate(final String command, final Map params, final HttpSession session, final String remoteAddress, final String responseType, final StringBuilder auditTrailSb, final HttpServletResponse resp) throws ServerApiException { try { - if (!params.containsKey("SAMLResponse")) { + if (!params.containsKey("SAMLResponse") && !params.containsKey("SAMLart")) { String idpUrl = null; final String[] idps = (String[])params.get(ApiConstants.IDP_URL); if (idps != null && idps.length > 0) { @@ -171,6 +171,10 @@ public class SAML2LoginAPIAuthenticatorCmd extends BaseCmd implements APIAuthent String redirectUrl = this.buildAuthnRequestUrl(idpUrl); resp.sendRedirect(redirectUrl); return ""; + } if (params.containsKey("SAMLart")) { + throw new ServerApiException(ApiErrorCode.UNSUPPORTED_ACTION_ERROR, _apiServer.getSerializedApiError(ApiErrorCode.UNSUPPORTED_ACTION_ERROR.getHttpCode(), + "SAML2 HTTP Artifact Binding is not supported", + params, responseType)); } else { final String samlResponse = ((String[])params.get(SAMLUtils.SAML_RESPONSE))[0]; Response processedSAMLResponse = this.processSAMLResponse(samlResponse);