Skip to content

Commit

Permalink
fix to treat IDToken header as case-insensitive (#144)
Browse files Browse the repository at this point in the history
Signed-off-by: Shikugawa <[email protected]>
  • Loading branch information
Shikugawa committed Jun 23, 2021
1 parent c0a99e3 commit 0a7227b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/config/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ xx_library(
"//src/common/http:http",
"@com_github_abseil-cpp//absl/strings:strings",
"@com_github_gabime_spdlog//:spdlog",
"@envoy//source/common/http:header_map_lib",
],
)
10 changes: 10 additions & 0 deletions src/config/get_config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <memory>

#include "config/config.pb.validate.h"
#include "envoy/http/header_map.h"
#include "spdlog/spdlog.h"
#include "src/common/http/http.h"

Expand Down Expand Up @@ -141,6 +142,15 @@ unique_ptr<Config> GetConfig(const string& configFileName) {

ConfigValidator::ValidateAll(*config);

// Check case-intensive properties
for (auto& filter_chain : *config->mutable_chains()) {
for (auto& filter : *filter_chain.mutable_filters()) {
const auto lower_header =
Envoy::Http::LowerCaseString(filter.oidc().id_token().header());
filter.mutable_oidc()->mutable_id_token()->set_header(lower_header.get());
}
}

return config;
}

Expand Down
2 changes: 1 addition & 1 deletion test/config/getconfig_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ TEST_F(GetConfigTest, OverrideOIDCConfigSuccess) {
"jwks": "default_jwk",
"id_token": {
"preamble": "Bearer",
"header": "authorization"
"header": "Authorization"
},
"client_id": "test-istio",
"client_secret": "xxxxx-yyyyy-zzzzz"
Expand Down

0 comments on commit 0a7227b

Please sign in to comment.