Skip to content

Commit

Permalink
deserializeSafeFromHeader uses context.getHeader(headerName) inst…
Browse files Browse the repository at this point in the history
…ead of `context.getHeaders()` (#2768) (#2771)

(cherry picked from commit 7c4e06d)

Co-authored-by: Paras Jain <parasjain.jain@outlook.com>
  • Loading branch information
opensearch-trigger-bot[bot] and parasjain1 authored May 15, 2023
1 parent 323a3df commit dae8f76
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions src/main/java/org/opensearch/security/support/HeaderHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
package org.opensearch.security.support;

import java.io.Serializable;
import java.util.Map;

import com.google.common.base.Strings;

Expand Down Expand Up @@ -56,15 +55,8 @@ public static String getSafeFromHeader(final ThreadContext context, final String
return null;
}

String headerValue = null;

Map<String, String> headers = context.getHeaders();
if (!headers.containsKey(headerName) || (headerValue = headers.get(headerName)) == null) {
return null;
}

if (isInterClusterRequest(context) || isTrustedClusterRequest(context) || isDirectRequest(context)) {
return headerValue;
return context.getHeader(headerName);
}

return null;
Expand Down

0 comments on commit dae8f76

Please sign in to comment.