Skip to content

Add bindings for csharp modules to use JWT claims#3414

Merged
jsdt merged 43 commits into
masterfrom
jsdt/csharp-claims
Oct 21, 2025
Merged

Add bindings for csharp modules to use JWT claims#3414
jsdt merged 43 commits into
masterfrom
jsdt/csharp-claims

Conversation

@jsdt

@jsdt jsdt commented Oct 16, 2025

Copy link
Copy Markdown
Contributor

Description of Changes

This exposes JWT claims for csharp modules, similar to how they are exposed to rust modules in #3288.

This adds the new types AuthCtx and JwtClaims, and adds an AuthCtx to the ReducerContext.

AuthCtx represents the credentials associated with the request, and JwtClaims represents a jwt token.

One difference from the rust version is that I didn't create helpers to build an AuthCtx from a jwt payload. The reason is that we would need to be able to compute the identity from the payload claims, which requires a blake3 hash implementation. The first two c# libraries I found had issues at runtime (Blake3 is wrapping a rust implementation, and HashifyNet seems to be broken by our trimming because it uses reflection heavily). I can look into taking the implementation from HashifyNet, since it is MIT licensed, but I don't think we need to block merging on that.

API and ABI breaking changes

This adds the new types AuthCtx and JwtClaims, and adds an AuthCtx to the ReducerContext.

This also adds a csharp wrapper for the get_jwt ABI function added in #3288.

Expected complexity level and risk

Testing

This has a very minimal unit test of JwtClaims.

I manually tested using this locally with the csharp quickstart, and I was able to print jwt tokens inside the module.

@jsdt jsdt requested a review from rekhoff October 17, 2025 16:48
@bfops bfops added the release-any Can land in any release window. Will not block a release deployment. label Oct 20, 2025
Comment thread crates/bindings-csharp/Runtime/JwtClaims.cs Outdated

@rekhoff rekhoff left a comment

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.

The changes/additions are clear and well commented; no objections. If we can get the comments addressed and the tests passing, that would be ideal, but I'll still mark my approval now.

@jsdt jsdt changed the base branch from jsdt/cred-bindings to master October 21, 2025 17:12
@jsdt jsdt requested a review from gefjon as a code owner October 21, 2025 17:12
Comment thread modules/quickstart-chat/src/lib.rs Outdated
@jsdt jsdt added this pull request to the merge queue Oct 21, 2025
Merged via the queue into master with commit bf37b29 Oct 21, 2025
25 of 27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-any Can land in any release window. Will not block a release deployment.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants