Skip to content

feat: support max_age and prompt in create_auth_url - #43

Open
scweber-cisco wants to merge 1 commit into
duosecurity:mainfrom
scweber-cisco:add-max-age-and-prompt
Open

feat: support max_age and prompt in create_auth_url#43
scweber-cisco wants to merge 1 commit into
duosecurity:mainfrom
scweber-cisco:add-max-age-and-prompt

Conversation

@scweber-cisco

@scweber-cisco scweber-cisco commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Summary

The OIDC Auth API documents two optional claims in the authorization request JWT that create_auth_url has no way to send:

  • max_age — maximum number of seconds since the user last authenticated interactively. A remembered session older than this forces interactive reauthentication.
  • prompt — set to login to force interactive reauthentication even when the user has a remembered session.

Both are optional keyword arguments and are only added to the JWT when provided, so existing callers are unaffected:

create_auth_url(username, state, nonce=None, dest_app_name=None,
                dest_app_id=None, display_username=None, max_age=None,
                prompt=None)

Test plan

Three new cases in tests/test_create_auth.py, each asserting the exact encoded request JWT:

  • max_age
  • max_age=0, guarding a truthiness pitfall
  • prompt='login'

The pre-existing tests assert the full expected JWT payload, so they already guard against the new claims appearing when unset.

Full suite passes (83 tests) and flake8 is clean.

🤖 Generated with Claude Code

Two more optional authorization request JWT claims that had no SDK
support:

- max_age: maximum seconds since the user's last interactive
  authentication; an older remembered session forces interactive reauth
- prompt: set to 'login' to force interactive reauthentication despite a
  remembered session

max_age is compared against None rather than checked for truthiness so
that a max_age of zero reaches Duo, since zero always forces interactive
reauthentication rather than meaning "unset".

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@scweber-cisco
scweber-cisco marked this pull request as ready for review September 4, 2026 18:14
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.

1 participant