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 incremental consent via MsalProvider #147

Merged
merged 4 commits into from
Aug 19, 2021

Conversation

shweaver-MSFT
Copy link
Member

@shweaver-MSFT shweaver-MSFT commented Aug 19, 2021

Fixes #8

PR Type

What kind of change does this PR introduce?

  • Bugfix

What is the current behavior?

MsalProvider does not currently support incremental consent. Requesting new scopes after the initial login will require the user to fully authenticate again.

In addition, the WithScopes parameter being passed in with the Graph requests is not being handled when the request is authenticated via MsalProvider.AuthenticateRequestAsync. The scopes are ignored currently and not used to actually make requests,

What is the new behavior?

With these changes, the MsalProvider will now use any specified alternate scopes with the graph request, and it will only ask for the user's password when consenting, instead of requiring full re-login.

I've also added a SemaphoreSlim to the MsalProvider and WindowsProvider to protect the provider from being bombarded with auth requests simultaneously, potentially causing throttling exceptions.

Lastly, I added a small fix to the PersonView to clear out PersonDetails and prevent stale data from showing up when one user logs out and another logs in.

PR Checklist

Please check if your PR fulfills the following requirements:

  • Tested code with current supported SDKs
  • Sample in sample app has been added / updated (for bug fixes / features)
  • Tests for the changes have been added (for bug fixes / features) (if applicable)
  • Header has been added to all new source files (run build/UpdateHeaders.bat)
  • Contains NO breaking changes

Other information

https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-permissions-and-consent#incremental-and-dynamic-user-consent

@ghost
Copy link

ghost commented Aug 19, 2021

Thanks shweaver-MSFT for opening a Pull Request! The reviewers will test the PR and highlight if there is any merge conflict or changes required. If the PR is approved we will proceed to merge the pull request 🙌

@shweaver-MSFT shweaver-MSFT merged commit ece3af0 into main Aug 19, 2021
@shweaver-MSFT shweaver-MSFT deleted the shweaver/incremental-consent branch August 19, 2021 16:10
Copy link
Member

@michael-hawker michael-hawker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Woot! 🎉🎉🎉

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.

Incremental Scope Consent asks for complete re-login
2 participants