Skip to content

[CHA-2595] add jwt token helper#29

Merged
mogita merged 2 commits intomasterfrom
cha-2595_add-jwt-token-helper
Mar 6, 2026
Merged

[CHA-2595] add jwt token helper#29
mogita merged 2 commits intomasterfrom
cha-2595_add-jwt-token-helper

Conversation

@mogita
Copy link
Collaborator

@mogita mogita commented Mar 6, 2026

No description provided.

Copilot AI review requested due to automatic review settings March 6, 2026 16:04
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a CreateUserToken public method to the BaseClient class that allows consumers to generate a signed JWT token for a specific user ID (with an optional custom expiration). It also adds a corresponding unit test file to verify correct claim embedding, default/custom expiration, signature validity, and per-user uniqueness. This fits into the broader SDK pattern of providing token-helper utilities alongside the existing GenerateServerSideToken method.

Changes:

  • New CreateUserToken(string userId, TimeSpan? expiration = null) public method added to BaseClient in src/Client.cs
  • Pre-existing GenerateServerSideToken refactored to remove the commented-out claims
  • New tests/CreateUserTokenTests.cs with 5 unit tests covering CreateUserToken behavior

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.

File Description
src/Client.cs Adds the CreateUserToken public method with XML documentation; cleans up the old commented-out claims in GenerateServerSideToken
tests/CreateUserTokenTests.cs New unit test class covering user ID claims, default/custom expiration, signature validity, and different-user token uniqueness

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@mogita mogita merged commit c8067a7 into master Mar 6, 2026
1 check passed
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