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 support for an authPolicy that returns Permission Denied when failed #1650

Merged
merged 4 commits into from
Dec 13, 2024

Conversation

inlined
Copy link
Member

@inlined inlined commented Dec 12, 2024

Per upcoming design (and to support onCallGenkit callable functions' options can now support an authPolicy callback. Adds support for this callback, as well as two helpers: isSignedIn and hasClaim.

@inlined inlined requested a review from taeold December 12, 2024 01:03
Copy link
Contributor

Choose a reason for hiding this comment

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

was checking in package-lock intentional? I don't see a change in package.json?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes. I couldn't successfully compile until I ran npm install and that changed package-lock.json

@@ -841,6 +842,14 @@ function wrapOnCallHandler<Req = any, Res = any>(
}

const data: Req = decode(req.body.data);
if (options.authPolicy) {
// Don't ask me why, but Google decided not to disambiguate between unauthenticated and unauthorized
Copy link
Contributor

Choose a reason for hiding this comment

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

is this true? we have permission-denied and unauthenticated:

https://github.com/grpc/grpc/blob/master/doc/statuscodes.md

Copy link
Member Author

Choose a reason for hiding this comment

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

I wrote this comment before I realized better. Will delete the comment.

@inlined inlined enabled auto-merge December 13, 2024 22:22
@inlined inlined added this pull request to the merge queue Dec 13, 2024
Merged via the queue into master with commit 46e6453 Dec 13, 2024
13 checks passed
Berlioz pushed a commit that referenced this pull request Dec 19, 2024
…led (#1650)

* Add support for an authPolicy that returns Permission Denied when failed

* Formatter

* Changelog

* remove ignorant comment
github-merge-queue bot pushed a commit that referenced this pull request Dec 19, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
…n top-level awaits (#1651)

* Use await import instead of require for functions modules that contain top-level awaits

* tests ensuring that es modules with top level awaits can be loaded

* adds node 22 to the CI matrix on github

* Add support for an authPolicy that returns Permission Denied when failed (#1650)

* Add support for an authPolicy that returns Permission Denied when failed

* Formatter

* Changelog

* remove ignorant comment

* Update streaming callable API (#1652)

* Update streaming callable API

* Fix linter error

* Stream type defaults to unknown

* Changelog

* Format fix

* update changelog.md

---------

Co-authored-by: Thomas Bouldin <inlined@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants