Skip to content

Commit

Permalink
cleanup: EntityIdParameterBuilder now always encode entityId
Browse files Browse the repository at this point in the history
  • Loading branch information
prigaux committed Jun 9, 2024
1 parent 0dd5c9d commit 6743710
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}


Expand Down

0 comments on commit 6743710

Please sign in to comment.