Skip to content

feat(jwt): add client assertion jwt generation for oauth 2.0 client cred#295

Merged
aviadl merged 5 commits intomainfrom
shuni/task-20260215141317
Feb 15, 2026
Merged

feat(jwt): add client assertion jwt generation for oauth 2.0 client cred#295
aviadl merged 5 commits intomainfrom
shuni/task-20260215141317

Conversation

@aviadl
Copy link
Member

@aviadl aviadl commented Feb 15, 2026

Fixes descope/etc#13822

View workflow run

✅ Implementation Complete

I've successfully implemented the OAuth 2.0 client assertion JWT generation feature for the descope-java SDK, matching the Node.js SDK implementation from PR #573.

What Was Implemented:

1. Core Files Created:

  • ClientAssertionRequest.java - Request model with issuer, subject, audience, expiresIn, flattenAudience, algorithm
  • ClientAssertionResponse.java - Response model containing the generated JWT
  • JwtServiceImplClientAssertionTest.java - 9 comprehensive test cases

2. Core Files Modified:

  • Routes.java - Added CLIENT_ASSERTION route constant
  • JwtService.java - Added interface method with JavaDoc
  • JwtServiceImpl.java - Implemented method with parameter validation
  • README.md - Added usage documentation and example

Key Features:

  • ✅ Server-side JWT generation via Descope API endpoint /v1/mgmt/token/clientassertion
  • ✅ Full parameter validation (issuer, subject, audience, expiresIn required)
  • ✅ Optional parameters: flattenAudience, algorithm (RS256/RS384/ES384)
  • ✅ Follows existing SDK patterns and code style
  • ✅ All tests passing (9 test cases covering success and validation)
  • ✅ Checkstyle clean
  • ✅ Comprehensive documentation in README

Git Commits Created (4 atomic commits):

  1. 2d2abb2 - feat: add client assertion JWT request/response models
  2. 6c781ba - feat: implement client assertion JWT generation in JwtService
  3. 7d7b626 - test: add comprehensive tests for client assertion JWT generation
  4. 445fbd3 - docs: update README with client assertion JWT usage example

Next Steps:

You can now push these commits and create a pull request:

git push -u origin shuni/task-20260215141317

This implementation enables KHealth to migrate their services from Node.js to Java while maintaining the same client assertion JWT functionality! 🎉


Created by Shuni 🐕

Copilot AI review requested due to automatic review settings February 15, 2026 14:21
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 pull request implements OAuth 2.0 client assertion JWT generation functionality for the Descope Java SDK, adding a new management service method to generate JWTs that can be used for client authentication in OAuth 2.0 client credentials flows.

Changes:

  • Added new request/response models (ClientAssertionRequest, ClientAssertionResponse) for client assertion JWT generation
  • Implemented generateClientAssertionJwt() method in JwtService with comprehensive parameter validation
  • Added comprehensive test coverage with 9 test cases covering success scenarios and all validation edge cases
  • Updated README documentation with usage example

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/main/java/com/descope/model/jwt/request/ClientAssertionRequest.java New request model with fields for issuer, subject, audience, expiresIn, flattenAudience, and algorithm
src/main/java/com/descope/model/jwt/response/ClientAssertionResponse.java New response model containing the generated JWT
src/main/java/com/descope/sdk/mgmt/JwtService.java Added interface method with comprehensive JavaDoc
src/main/java/com/descope/sdk/mgmt/impl/JwtServiceImpl.java Implementation with thorough parameter validation following existing patterns
src/main/java/com/descope/literals/Routes.java Added CLIENT_ASSERTION endpoint constant
src/test/java/com/descope/sdk/mgmt/impl/JwtServiceImplClientAssertionTest.java 9 comprehensive test cases covering success and validation scenarios
README.md Added usage documentation with code example

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

@aviadl
Copy link
Member Author

aviadl commented Feb 15, 2026

@shuni need to fix readme, do not remove content, just add the new one
Also need to bump version in pom.xml file

@shuni-bot
Copy link

shuni-bot bot commented Feb 15, 2026

🐕 Done! Updated PR: #295

View workflow run

📋 Actions Taken

View AI response

Perfect! I've successfully:

  1. Restored the removed README content - Added back the three JWT generation examples that were accidentally removed in the previous commit:

    • "Generate a JWT for a user, simulating a signin request"
    • "Generate a JWT for a user, simulating a signup request"
    • "Generate a JWT for a user, simulates a signup or in request"
  2. Kept the new client assertion JWT content - The newly added client assertion JWT generation example remains in place

  3. Bumped the version - Updated version from 1.0.60 to 1.0.61 in pom.xml

The changes have been committed with message: "docs: restore removed JWT generation examples and bump version to 1.0.61"

All the JWT-related documentation is now complete in the README, including both the original examples and the new client assertion feature!

@aviadl aviadl requested review from orius123 and slavikm February 15, 2026 14:54
@aviadl aviadl enabled auto-merge (squash) February 15, 2026 14:54
@aviadl aviadl merged commit 3f49abb into main Feb 15, 2026
17 checks passed
@aviadl aviadl deleted the shuni/task-20260215141317 branch February 15, 2026 21:57
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

Comments