-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Add the groups claim to the attribute request.auth.groups #1896
Changes from all commits
6ca1fe9
027e26c
4d42289
ad26f53
9fa8cf5
0b604c8
1a5a19a
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 |
---|---|---|
|
@@ -74,6 +74,15 @@ void Authentication::SaveAuthAttributesToStruct( | |
setKeyValue(data, istio::utils::AttributeName::kRequestAuthAudiences, | ||
origin.audiences(0)); | ||
} | ||
if (!origin.groups().empty()) { | ||
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. This is about to be removed. You need to add this logic to SaveAuthAttributesToStruct instead. 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. Have discussed it offline and it is already in SaveAuthAttributesToStruct. |
||
::google::protobuf::ListValue* value; | ||
value = (*data.mutable_fields()) | ||
[istio::utils::AttributeName::kRequestAuthGroups] | ||
.mutable_list_value(); | ||
for (int i = 0; i < origin.groups().size(); i++) { | ||
value->add_values()->set_string_value(origin.groups(i)); | ||
} | ||
} | ||
if (!origin.presenter().empty()) { | ||
setKeyValue(data, istio::utils::AttributeName::kRequestAuthPresenter, | ||
origin.presenter()); | ||
|
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.
Can we extend this to any string array claims?
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.
The claim key (e.g., kJwtGroupsKey, kJwtAudienceKey) can be extended as an argument of the extraction function to support extracting any claims with the key. However, it is not straightforward to make the following statements in these extraction functions to be generic for extracting any claim key. If you have a way to do it, please let me know.
payload->add_audiences(claims.at(key));
payload->add_groups(claims.at(key));