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

Feature: Add support for grpc middleware interceptors #291

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

cmmoran
Copy link

@cmmoran cmmoran commented Nov 10, 2024

📝 Checklist

  • All new/changed/fixed functionality is covered by tests (or N/A)
  • I have added documentation for all new/changed functionality (or N/A)

🔧 Changes

  • Expanded the TokenExtractor by creating a ContextTokenExtractor to allow extracting a token from metadata.
  • Expanded ErrorHandlers by adding grpc unary and stream default error handlers that loosely mimic the same functionality as the http-based default error handler
  • Expanded JWTMiddleware by creating GrpcMiddleware which contains a unary interceptor and a stream interceptor that can be optionally specified via the new GrpcOption type
  • Omitted validateOnOptions for GrpcOption as it didn't seem relevant
  • Included credentialsOptional for GrpcOption to allow optional credentials for grpc (as it seemed relevant)
  • Added a trivial example under the examples folder: grpc-example for relevant grpc usage.

📚 References

#181

🔬 Testing

  • I tried to keep true to the ContextKey{} paradigm so that the server-side handler can check the context for this key to contain the *validator.ValidatedClaims structure for validated token claims
  • ErrJWTInvalid and ErrJWTMissing are utilized through the grpc status.Errorf function to return the relevant status with the error

dependabot bot and others added 6 commits October 3, 2024 14:13
Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 6.1.0 to 6.1.1.
- [Release notes](https://github.com/golangci/golangci-lint-action/releases)
- [Commits](golangci/golangci-lint-action@aaa42aa...971e284)

---
updated-dependencies:
- dependency-name: golangci/golangci-lint-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Bumps [Templum/govulncheck-action](https://github.com/templum/govulncheck-action) from 1.0.0 to 1.0.1.
- [Release notes](https://github.com/templum/govulncheck-action/releases)
- [Commits](Templum/govulncheck-action@6bb063b...0d775f4)

---
updated-dependencies:
- dependency-name: Templum/govulncheck-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Bumps [golang.org/x/sync](https://github.com/golang/sync) from 0.8.0 to 0.9.0.
- [Commits](golang/sync@v0.8.0...v0.9.0)

---
updated-dependencies:
- dependency-name: golang.org/x/sync
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
@cmmoran cmmoran requested a review from a team as a code owner November 10, 2024 19:50
@agruetz
Copy link

agruetz commented Nov 14, 2024

Any ideas when this might get merged? This is exactly what I need. Is there anything I could do to help move it forward quickly?

dependabot bot and others added 2 commits December 19, 2024 07:32
Bumps [Templum/govulncheck-action](https://github.com/templum/govulncheck-action) from 1.0.0 to 1.0.1.
- [Release notes](https://github.com/templum/govulncheck-action/releases)
- [Commits](Templum/govulncheck-action@6bb063b...0d775f4)

---
updated-dependencies:
- dependency-name: Templum/govulncheck-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
@cmmoran cmmoran force-pushed the feat/grpc-middleware branch from 9272752 to 4b4d391 Compare December 20, 2024 10:24
@cmmoran cmmoran force-pushed the feat/grpc-middleware branch from 4b4d391 to 224c193 Compare December 20, 2024 10:31
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.

2 participants