Skip to content

Set outgoing JWT expiration to 5 minutes to match other SDKs - #66

Merged
AaronAtDuo merged 1 commit into
mainfrom
fix/jwt-exp-five-minutes
Aug 25, 2026
Merged

Set outgoing JWT expiration to 5 minutes to match other SDKs#66
AaronAtDuo merged 1 commit into
mainfrom
fix/jwt-exp-five-minutes

Conversation

@AaronAtDuo

Copy link
Copy Markdown
Contributor

Summary

The Java SDK signs its outgoing JWTs (the authorization-request JWT in createJwtForAuthUrl and the client-assertion JWT in createJwt) with a 1-hour expiration. Every other Duo Universal Prompt SDK uses a 5-minute expiration:

SDK Expiration Source
Java (before) 1 hour Utils.java ONE_HOUR_IN_MILLISECONDS = 3600000
C# 5 min JwtUtils.cs AddMinutes(FIVE_MINUTES)
Go 5 min client.go const expirationTime = 300
Node.js 5 min constants.ts JWT_EXPIRATION = 300
PHP 5 min Client.php JWT_EXPIRATION = 300
Python 5 min (default; capped at 5 min) client.py FIVE_MINUTES_IN_SECONDS

This change brings Java in line with the rest of the SDK family by changing the expiration from 3600000 ms (1 hour) to 300000 ms (5 minutes), shrinking the validity window of these short-lived tokens by 12x.

Changes

  • Rename ONE_HOUR_IN_MILLISECONDSFIVE_MINUTES_IN_MILLISECONDS and set it to 300000. Applies to both createJwt and createJwtForAuthUrl.

Testing

  • mvn test — all 53 tests pass.
  • mvn checkstyle:check — 0 violations.

No existing test asserts on the outgoing JWT's exp value, so no test changes were needed.

This PR description was generated with AI assistance (Claude).

🤖 Generated with Claude Code

The Java SDK signed its authorization-request and client-assertion JWTs
with a 1-hour expiration, while every other Duo Universal Prompt SDK
(C#, Go, Node.js, PHP, Python) uses a 5-minute expiration. Python
additionally caps the configurable value at 5 minutes and rejects
anything longer.

This aligns Java with the rest of the SDK family by changing the
expiration from 3600000 ms (1 hour) to 300000 ms (5 minutes), reducing
the validity window of these short-lived tokens by 12x.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@AaronAtDuo
AaronAtDuo merged commit 90011c9 into main Aug 25, 2026
6 checks passed
@AaronAtDuo
AaronAtDuo deleted the fix/jwt-exp-five-minutes branch August 25, 2026 15:27
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.

3 participants