Skip to content
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 matcher for used OIDC user name #639

Merged

Conversation

creydr
Copy link
Contributor

@creydr creydr commented Dec 4, 2023

Add a event matcher, to check the OIDC user name of the received event.

This adds two new functions:

  • MatchOIDCUser(username) to directly check if the given username matches the OIDC username in EventInfo
  • MatchOIDCUserFromResource(gvr, resourceName) to check, if the OIDC username from the given resource matches the OIDC username in the EventInfo

This allows e.g. testcases like the following:

...
f.Alpha("Broker").
	Must("subscriber receives event from correct sender identity", eventassert.OnStore(sink).MatchWithContext(eventassert.MatchOIDCUserFromResource(triggerresources.GVR(), triggerName)).Exact(1))

@knative-prow knative-prow bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Dec 4, 2023
@knative-prow knative-prow bot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Dec 4, 2023
@creydr creydr force-pushed the add-matcher-for-used-oidc-user branch from cf693f6 to 1c3c1d2 Compare February 21, 2024 11:59
@knative-prow knative-prow bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Feb 21, 2024
@creydr creydr force-pushed the add-matcher-for-used-oidc-user branch from 21f47e7 to a6ddc67 Compare April 22, 2024 08:56
@creydr creydr changed the title [WIP] Add matcher for used OIDC user name Add matcher for used OIDC user name Apr 22, 2024
@knative-prow knative-prow bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Apr 22, 2024
@creydr
Copy link
Contributor Author

creydr commented Apr 22, 2024

/cc @pierDipi @Cali0707
ready for review

Copy link
Member

@Cali0707 Cali0707 left a comment

Choose a reason for hiding this comment

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

Just some small nits that I think will make it easier to debug failures when using this, otherwise LGTM

pkg/eventshub/assert/event_info_matchers.go Outdated Show resolved Hide resolved
pkg/eventshub/assert/event_info_matchers.go Outdated Show resolved Hide resolved
@creydr creydr requested a review from Cali0707 April 25, 2024 07:45
Copy link
Member

@Cali0707 Cali0707 left a comment

Choose a reason for hiding this comment

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

/lgtm

Copy link

knative-prow bot commented Apr 25, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Cali0707, creydr

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@knative-prow knative-prow bot added the lgtm Indicates that a PR is ready to be merged. label Apr 25, 2024
@knative-prow knative-prow bot merged commit e8273a6 into knative-extensions:main Apr 25, 2024
24 of 26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. 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.

2 participants