mirror of
https://github.com/datahub-project/datahub.git
synced 2025-08-15 20:57:15 +00:00
fix(auth): ignore case when comparing http headers (#8356)
This commit is contained in:
parent
2ca7f566f8
commit
352a54a7bf
@ -136,11 +136,11 @@ public class Application extends Controller {
|
|||||||
.stream()
|
.stream()
|
||||||
// Remove X-DataHub-Actor to prevent malicious delegation.
|
// Remove X-DataHub-Actor to prevent malicious delegation.
|
||||||
.filter(entry -> !AuthenticationConstants.LEGACY_X_DATAHUB_ACTOR_HEADER.equalsIgnoreCase(entry.getKey()))
|
.filter(entry -> !AuthenticationConstants.LEGACY_X_DATAHUB_ACTOR_HEADER.equalsIgnoreCase(entry.getKey()))
|
||||||
.filter(entry -> !Http.HeaderNames.CONTENT_LENGTH.equals(entry.getKey()))
|
.filter(entry -> !Http.HeaderNames.CONTENT_LENGTH.equalsIgnoreCase(entry.getKey()))
|
||||||
.filter(entry -> !Http.HeaderNames.CONTENT_TYPE.equals(entry.getKey()))
|
.filter(entry -> !Http.HeaderNames.CONTENT_TYPE.equalsIgnoreCase(entry.getKey()))
|
||||||
.filter(entry -> !Http.HeaderNames.AUTHORIZATION.equals(entry.getKey()))
|
.filter(entry -> !Http.HeaderNames.AUTHORIZATION.equalsIgnoreCase(entry.getKey()))
|
||||||
// Remove Host s.th. service meshes do not route to wrong host
|
// Remove Host s.th. service meshes do not route to wrong host
|
||||||
.filter(entry -> !Http.HeaderNames.HOST.equals(entry.getKey()))
|
.filter(entry -> !Http.HeaderNames.HOST.equalsIgnoreCase(entry.getKey()))
|
||||||
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue))
|
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue))
|
||||||
)
|
)
|
||||||
.addHeader(Http.HeaderNames.AUTHORIZATION, authorizationHeaderValue)
|
.addHeader(Http.HeaderNames.AUTHORIZATION, authorizationHeaderValue)
|
||||||
@ -152,8 +152,8 @@ public class Application extends Controller {
|
|||||||
final ResponseHeader header = new ResponseHeader(apiResponse.getStatus(), apiResponse.getHeaders()
|
final ResponseHeader header = new ResponseHeader(apiResponse.getStatus(), apiResponse.getHeaders()
|
||||||
.entrySet()
|
.entrySet()
|
||||||
.stream()
|
.stream()
|
||||||
.filter(entry -> !Http.HeaderNames.CONTENT_LENGTH.equals(entry.getKey()))
|
.filter(entry -> !Http.HeaderNames.CONTENT_LENGTH.equalsIgnoreCase(entry.getKey()))
|
||||||
.filter(entry -> !Http.HeaderNames.CONTENT_TYPE.equals(entry.getKey()))
|
.filter(entry -> !Http.HeaderNames.CONTENT_TYPE.equalsIgnoreCase(entry.getKey()))
|
||||||
.map(entry -> Pair.of(entry.getKey(), String.join(";", entry.getValue())))
|
.map(entry -> Pair.of(entry.getKey(), String.join(";", entry.getValue())))
|
||||||
.collect(Collectors.toMap(Pair::getFirst, Pair::getSecond)));
|
.collect(Collectors.toMap(Pair::getFirst, Pair::getSecond)));
|
||||||
final HttpEntity body = new HttpEntity.Strict(apiResponse.getBodyAsBytes(), Optional.ofNullable(apiResponse.getContentType()));
|
final HttpEntity body = new HttpEntity.Strict(apiResponse.getBodyAsBytes(), Optional.ofNullable(apiResponse.getContentType()));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user