Skip to content

Authn Filter Config for Beta Authn Policy#19422

Merged
istio-testing merged 11 commits intoistio:masterfrom
incfly:authn/applier
Dec 9, 2019
Merged

Authn Filter Config for Beta Authn Policy#19422
istio-testing merged 11 commits intoistio:masterfrom
incfly:authn/applier

Conversation

@incfly
Copy link
Copy Markdown

@incfly incfly commented Dec 5, 2019

Beta authn policy still uses the old authn filter, with specially crafted configuration.

@incfly incfly requested a review from a team as a code owner December 5, 2019 20:49
@istio-testing istio-testing added the do-not-merge/work-in-progress Block merging of a PR because it isn't ready yet. label Dec 5, 2019
@googlebot googlebot added the cla: yes Set by the Google CLA bot to indicate the author of a PR has signed the Google CLA. label Dec 5, 2019
@istio-testing istio-testing added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Dec 5, 2019
@incfly incfly requested a review from diemtvu December 5, 2019 20:50
@incfly incfly changed the title WIP - Authn Filter Config for Beta Authn Policy Authn Filter Config for Beta Authn Policy Dec 5, 2019
@istio-testing istio-testing removed the do-not-merge/work-in-progress Block merging of a PR because it isn't ready yet. label Dec 5, 2019
@incfly
Copy link
Copy Markdown
Author

incfly commented Dec 5, 2019

I went through the fields in the filter config and policy. Haven't done a e2e test, but I think its ready for review, excepting adding more test cases. @diemtvu

PrincipalBinding: authn_alpha.PrincipalBinding_USE_ORIGIN,
}
// TODO: does it matter if this is empty but not nil?
jwtLocation := map[string]string{}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this can be deprecated now. It was used to find the payload, but since we moved to dynamic metadata, the field was obsolete and unused.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

}
// TODO: does it matter if this is empty but not nil?
jwtLocation := map[string]string{}
for _, jwt := range jwtRules {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may want to sort the rule alphabetically by issuer (ignore this if you already did it when calling this function)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we do this in the applier init?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// NewPolicyApplier returns new applier for v1beta1 authentication policies.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can. Feel free to change that one.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done. sorted and add one more test case.

Name: authn_model.AuthnFilterName,
}
filterConfigProto := convertToIstioAuthnFilterConfig(a.processedJwtRules)
if filterConfigProto == nil {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit. convertToIstioAuthnFilterConfig never returns nil (should it?), so this is not necessary.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think that's fine. caller be more agnostic of the actual implementation is a good thing IMO.

t.Run(c.name, func(t *testing.T) {
got := NewPolicyApplier(c.in).AuthNFilter(model.SidecarProxy, false)
if !reflect.DeepEqual(c.expected, got) {
// t.Logf("struct literal\n%#v\n", got.ConfigType)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

@incfly incfly requested a review from a team December 8, 2019 20:05
@incfly
Copy link
Copy Markdown
Author

incfly commented Dec 8, 2019

I'll delete the code links for the fields reference before the merge.

@istio-testing istio-testing merged commit 21be274 into istio:master Dec 9, 2019
@incfly incfly deleted the authn/applier branch December 10, 2019 01:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes Set by the Google CLA bot to indicate the author of a PR has signed the Google CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants