Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Support For Passing Nonce and Configurable JWT Expiry #22

Merged
merged 3 commits into from
Feb 2, 2024

Conversation

rpcope1
Copy link
Contributor

@rpcope1 rpcope1 commented Jan 31, 2024

Description

  • Added support to the Python client to allow the nonce to be set in the auth URL
  • Added a client parameter to allow JWT expiry to be configured.
  • Updated some tests to check nonce validation.

Motivation and Context

I am working on integrating the Duo Universal prompt into an existing Python application that already does OIDC auth flows, and utilizing the OIDC nonce and potentially setting a shorter expiry window is being considered. These are supported in the Duo OIDC doc, but not exposed in the Python client library, so this would add that.

How Has This Been Tested?

  • I've added a couple of unit tests.

Types of Changes

  • [?] Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

* Added support to the Python client to allow the nonce to be set in
  the auth URL
* Added a client parameter to allow JWT expiry to be configured.
* Updated some tests to check nonce validation.
duo_universal/client.py Outdated Show resolved Hide resolved
duo_universal/client.py Outdated Show resolved Hide resolved
duo_universal/client.py Outdated Show resolved Hide resolved
@rpcope1
Copy link
Contributor Author

rpcope1 commented Feb 1, 2024

The suggestions make sense, I will integrate changes to reflect you comments above.

* Client now throws an exception if an out of range expiry
  was given on initialization; the value is furthermore
  clamped to between 0 seconds and 5 minutes where it's used.
* Doc strings have been updated to reflect what the underlying
  OIDC API specifies around the state and nonce.
* Tests have been added to verify that the expiry is checked
  correctly.
@rpcope1
Copy link
Contributor Author

rpcope1 commented Feb 1, 2024

I have just pushed another commit that should hopefully address the points you've mentioned in the code review.

@AaronAtDuo
Copy link
Contributor

@rpcope1 Thanks! This looks great. Just need to fix the linter issue so the tests will run, then I think we can get this merged.

@rpcope1
Copy link
Contributor Author

rpcope1 commented Feb 2, 2024

@rpcope1 Thanks! This looks great. Just need to fix the linter issue so the tests will run, then I think we can get this merged.

I just pushed a change set that I think will address the linter errors. Thank you so much for your help with this.

@AaronAtDuo AaronAtDuo merged commit 0716495 into duosecurity:main Feb 2, 2024
5 checks passed
@AaronAtDuo
Copy link
Contributor

I think enough has been added since the last release that it's worth putting one out. I'll try to get that done early next week.

@AaronAtDuo
Copy link
Contributor

Thanks @rpcope1! The PR is merged and I'll try to get a release out next week.

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