From 6743710ee38aa21191e5dba5e4e9be98dfd8b83d Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Tue, 5 Jul 2022 12:47:56 +0200 Subject: [PATCH] cleanup: EntityIdParameterBuilder now always encode entityId --- .../authn/provider/extra/EntityIdParameterBuilder.java | 8 ++------ .../net/unicon/idp/externalauth/ShibcasAuthServlet.java | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/main/java/net/unicon/idp/authn/provider/extra/EntityIdParameterBuilder.java b/src/main/java/net/unicon/idp/authn/provider/extra/EntityIdParameterBuilder.java index 7f463b4..a9a6ebe 100644 --- a/src/main/java/net/unicon/idp/authn/provider/extra/EntityIdParameterBuilder.java +++ b/src/main/java/net/unicon/idp/authn/provider/extra/EntityIdParameterBuilder.java @@ -18,23 +18,19 @@ public class EntityIdParameterBuilder implements IParameterBuilder { @Override public String getParameterString(final HttpServletRequest request, final String authenticationKey) { - return getParameterString(request, true); + return getParameterString(request); } - public String getParameterString(final HttpServletRequest request, final boolean encode) { + public String getParameterString(final HttpServletRequest request) { final String relayingPartyId = request.getAttribute(ExternalAuthentication.RELYING_PARTY_PARAM).toString(); String rpId = "error-encoding-rpid"; - if (encode) { try { rpId = URLEncoder.encode(relayingPartyId, "UTF-8"); } catch (final UnsupportedEncodingException e) { logger.error("Error encoding the relying party id.", e); } - } else { - rpId = relayingPartyId; - } return "&entityId=" + rpId; } diff --git a/src/main/java/net/unicon/idp/externalauth/ShibcasAuthServlet.java b/src/main/java/net/unicon/idp/externalauth/ShibcasAuthServlet.java index 7f87969..ec505e9 100644 --- a/src/main/java/net/unicon/idp/externalauth/ShibcasAuthServlet.java +++ b/src/main/java/net/unicon/idp/externalauth/ShibcasAuthServlet.java @@ -277,7 +277,7 @@ protected String constructServiceUrl(final HttpServletRequest request, final Htt serviceParameterName, artifactParameterName, true); if ("embed".equalsIgnoreCase(entityIdLocation)) { - serviceUrl += (new EntityIdParameterBuilder().getParameterString(request, true)); + serviceUrl += (new EntityIdParameterBuilder().getParameterString(request)); }