Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasmatusiewicz committed Sep 26, 2023
1 parent b1da862 commit affa5c4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -117,11 +117,11 @@ protected void extractChallengeData(@Nonnull PIResponse piResponse)
*/
protected Map<String, String> getHeadersToForward(HttpServletRequest request)
{
Map<String, String> headersToForward = new LinkedHashMap<>();
if (piServerConfigContext.getConfigParams().getForwardHeaders() != null && !piServerConfigContext.getConfigParams().getForwardHeaders().isEmpty())
{
String cleanHeaders = piServerConfigContext.getConfigParams().getForwardHeaders().replaceAll(" ", "");
List<String> headersList = List.of(cleanHeaders.split(","));
Map<String, String> headersToForward = new LinkedHashMap<>();

for (String headerName : headersList.stream().distinct().collect(Collectors.toList()))
{
Expand All @@ -135,7 +135,7 @@ protected Map<String, String> getHeadersToForward(HttpServletRequest request)
}
}

if(!headerValues.isEmpty())
if (!headerValues.isEmpty())
{
String temp = String.join(",", headerValues);
headersToForward.put(headerName, temp);
Expand All @@ -145,9 +145,8 @@ protected Map<String, String> getHeadersToForward(HttpServletRequest request)
LOGGER.info("{} No values for header \"" + headerName + "\" found.", this.getLogPrefix());
}
}
return headersToForward;
}
return new LinkedHashMap<>();
return headersToForward;
}

// Logger implementation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ protected final void doExecute(@Nonnull ProfileRequestContext profileRequestCont
Map<String, String> headers = new LinkedHashMap<>();
if (request != null)
{
headers = this.getHeadersToForward(request);
headers = this.getHeadersToForward(request);
}
else
{
Expand Down

0 comments on commit affa5c4

Please sign in to comment.