Skip to content
This repository has been archived by the owner on Jul 18, 2022. It is now read-only.

WebSDK v2 to WebSDK v4 Code Migration Guide #57

Draft
wants to merge 9 commits into
base: flask_demo
Choose a base branch
from

Conversation

jeffreyparker
Copy link
Contributor

A step-by-step walk-though on the changes required to migrate a WebSDK v2 integration to the WebSDK v2 Universal Prompt.

Click into each commit for the detailed information and code changes.

Swap out the old Web SDK v2 package for the new Web SDK v4
- ikey and skey renamed to client_id and client_secret
- akey no longer needed
- redirect_uri is a new field for the URI Duo should redirect to after the prompt
Rather than directly accessing sdk methods as in v2, now all interaction occurs through the Client object
Check Duo service health before attempting 2FA and react appropriately (i.e. fail open or fail closed)
We no longer need the html/javascript/css to display the Duo prompt in an iFrame.
Instead, we redirect to a Duo-hosted URL which will display the prompt, and then redirect back into our application.
Previously, the Duo iFrame would POST back to the same page.

Now, the Duo-hosted prompt will GET redirect to the URI specified in the redirect_uri parameter.
Both state and username must be accessible from the callback method, so we must store them in the session.
This is an important security check to ensure our session hasn't been tampered with
- username now comes from session instead of sdk return value
- exchange_authorization_code_for_2fa_result will raise an Exception if 2FA fails, otherwise we can assume 2FA was successful
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant