Repository navigation
Add remaining optional authorization request parameters - #62
Open
scweber-cisco wants to merge 1 commit into
Open
scweber-cisco wants to merge 1 commit into
scweber-cisco wants to merge 1 commit into
Conversation
The OIDC Auth API documents five optional parameters for the authorization request JWT that createAuthUrl had no way to send: dest_app_name, dest_app_id, display_username, max_age and prompt. Add them to AuthUrlOptions alongside nonce, following the same omit-when-undefined pattern so the request payload is unchanged for callers who don't use them. max_age is validated as a non-negative integer, since 0 is meaningful (it forces interactive authentication) and would be dropped by a truthiness check. prompt is typed as the literal 'login', which is the only value Duo currently supports. https://duo.com/docs/oauthapi Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #62 +/- ##
========================================
Coverage ? 100.00%
========================================
Files ? 5
Lines ? 163
Branches ? 43
========================================
Hits ? 163
Misses ? 0
Partials ? 0 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
scweber-cisco
marked this pull request as ready for review
September 22, 2026 20:44
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The OIDC Auth API documents five optional parameters for the authorization request JWT that
createAuthUrlhad no way to send. This adds them toAuthUrlOptions, alongside thenonceoption added in #60.dest_app_namestringdest_app_idstringdisplay_usernamestringmax_agenumberDuoExceptionprompt'login'Each option follows the same omit-when-undefined pattern as
nonce, so the request payload is byte-for-byte unchanged for callers who don't use them.Notes on two judgment calls
max_age: 0is tested explicitly. Zero is the documented way to force interactive authentication, and it's falsy — aif (max_age)guard would silently drop it. The validation is!Number.isInteger(max_age) || max_age < 0.promptis typed as the literal'login'rather thanstring. That is the only value Duo currently supports, so the type documents the real contract; it will need widening if Duo adds others. No runtime check was added, so a plain-JS caller passing something else still reaches Duo rather than being gated by the SDK.Test plan
test/client/auth-url.test.ts, written test-first: one per option asserting the claim lands in the verified request JWT,max_age: 0, negative and non-integermax_agerejection, and one test asserting all five claims are absent when no options are passed..d.tsto confirm the new options are visible to package consumers and thatprompt: 'consent',max_age: '300'and a misspelled key are all rejected.🤖 Generated with Claude Code