-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Use dynamic metadata to for authentication filter output. #1901
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
ba72d63
325942d
3f0bf9e
1357d76
9e80b59
53c0094
16cf731
9c0f2a4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,7 +20,7 @@ | |
| #include <map> | ||
| #include <string> | ||
|
|
||
| #include "google/protobuf/map.h" | ||
| #include "google/protobuf/struct.pb.h" | ||
| #include "mixer/v1/attributes.pb.h" | ||
|
|
||
| namespace istio { | ||
|
|
@@ -89,18 +89,20 @@ class AttributesBuilder { | |
| } | ||
| } | ||
|
|
||
| void AddProtobufStringMap( | ||
| const std::string& key, | ||
| const google::protobuf::Map<std::string, ::std::string>& string_map) { | ||
| if (string_map.empty()) { | ||
| void AddProtoStructStringMap(const std::string& key, | ||
| const google::protobuf::Struct& struct_map) { | ||
| if (struct_map.fields().empty()) { | ||
| return; | ||
| } | ||
| auto entries = (*attributes_->mutable_attributes())[key] | ||
| .mutable_string_map_value() | ||
| ->mutable_entries(); | ||
| entries->clear(); | ||
| for (const auto& map_it : string_map) { | ||
| (*entries)[map_it.first] = map_it.second; | ||
| for (const auto& field : struct_map.fields()) { | ||
| // Ignore all fields that are not string. | ||
| if (!field.second.string_value().empty()) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it okay to use
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Then it's not worth to send it over, I think :). Anyway, change to kind_case. |
||
| (*entries)[field.first] = field.second.string_value(); | ||
| } | ||
| } | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
returns nullptr.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done