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)
  • Loading branch information
parasjain1 authored May 13, 2023
1 parent 48c4f96 commit 7c4e06d
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 @@ -57,15 +56,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 7c4e06d

Please sign in to comment.