diff --git a/privacyIDEA-impl/src/main/java/org/privacyidea/action/AbstractChallengeResponseAction.java b/privacyIDEA-impl/src/main/java/org/privacyidea/action/AbstractChallengeResponseAction.java index 6c15371..4490767 100644 --- a/privacyIDEA-impl/src/main/java/org/privacyidea/action/AbstractChallengeResponseAction.java +++ b/privacyIDEA-impl/src/main/java/org/privacyidea/action/AbstractChallengeResponseAction.java @@ -17,8 +17,8 @@ import org.privacyidea.IPILogger; import org.privacyidea.PIResponse; import org.privacyidea.PrivacyIDEA; -import org.privacyidea.context.PIServerConfigContext; import org.privacyidea.context.PIContext; +import org.privacyidea.context.PIServerConfigContext; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -117,11 +117,11 @@ protected void extractChallengeData(@Nonnull PIResponse piResponse) */ protected Map getHeadersToForward(HttpServletRequest request) { + Map headersToForward = new LinkedHashMap<>(); if (piServerConfigContext.getConfigParams().getForwardHeaders() != null && !piServerConfigContext.getConfigParams().getForwardHeaders().isEmpty()) { String cleanHeaders = piServerConfigContext.getConfigParams().getForwardHeaders().replaceAll(" ", ""); List headersList = List.of(cleanHeaders.split(",")); - Map headersToForward = new LinkedHashMap<>(); for (String headerName : headersList.stream().distinct().collect(Collectors.toList())) { @@ -135,7 +135,7 @@ protected Map getHeadersToForward(HttpServletRequest request) } } - if(!headerValues.isEmpty()) + if (!headerValues.isEmpty()) { String temp = String.join(",", headerValues); headersToForward.put(headerName, temp); @@ -145,9 +145,8 @@ protected Map getHeadersToForward(HttpServletRequest request) LOGGER.info("{} No values for header \"" + headerName + "\" found.", this.getLogPrefix()); } } - return headersToForward; } - return new LinkedHashMap<>(); + return headersToForward; } // Logger implementation diff --git a/privacyIDEA-impl/src/main/java/org/privacyidea/action/TriggerChallenge.java b/privacyIDEA-impl/src/main/java/org/privacyidea/action/TriggerChallenge.java index b3d8fcf..0075c0f 100644 --- a/privacyIDEA-impl/src/main/java/org/privacyidea/action/TriggerChallenge.java +++ b/privacyIDEA-impl/src/main/java/org/privacyidea/action/TriggerChallenge.java @@ -32,7 +32,7 @@ protected final void doExecute(@Nonnull ProfileRequestContext profileRequestCont Map headers = new LinkedHashMap<>(); if (request != null) { - headers = this.getHeadersToForward(request); + headers = this.getHeadersToForward(request); } else {