Skip to content

Microsoft.Identity.Web refactor #272

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

Merged
merged 60 commits into from
Feb 19, 2020
Merged

Microsoft.Identity.Web refactor #272

merged 60 commits into from
Feb 19, 2020

Conversation

TiagoBrenck
Copy link
Contributor

@TiagoBrenck TiagoBrenck commented Jan 27, 2020

Intro

This PR might look like a beast, but it is less scary than you think. A lot of files got changed because this branch also includes the renaming of the methods: AddMicrosoftIdentityPlatformAuthentication, AddMsal and GetAccessTokenOnBehalfOfUserAsync.

I will add a comment on each file that have been modified on the refactoring, explaining the "why's"

Purpose

The mainly 3 purpose of this change are:

  • Remove AzureAD.UI and AzureADB2C.UI packages
  • Unify B2C and AAD logic to acquire tokens, remove accounts, sign-in and all helpers provided by the extension library
  • Leverage OpenIdConnectOptions and JwtBearerOptions classes for configuration

The byproduct of this refactoring includes, but is not limited to:

  • Given more flexibility to developer customize their authN/authZ configurations using Microsoft.Identity.Web
  • Possibility to have more OIDC schemes configured without having shemes conflicts. Using AAD and Google for instance, or maybe multiple AAD configurarions
  • Taken control of configurations once blocked by AzureAD.UI packages, like the usage of all attributes of OpenIdConnectOptions

Does this introduce a breaking change?

[ ] Yes
[x] No (Although [Obsolete] attribute was used)

Pull Request Type

What kind of change does this Pull Request introduce?

[ ] Bugfix
[x] Feature
[ ] Code style update (formatting, local variables)
[x] Refactoring (no functional changes, no api changes)
[x] Documentation content changes
[ ] Other... Please describe:

Pending tasks

  1. Include a B2C calling Web API
  2. Investigate RemoveAccountAsync on B2C scenario
  3. Update Readme s
  4. Have a scenario with 2 different OIDC configurations

jmprieur and others added 27 commits December 5, 2019 14:15
- AddMicrosoftIdentityPlatformAuthentication => AddSignIn
- AddMsal => AddWebAppCallProtectedWebApi
…he comfort AzureAD layers)

This code does not work yet ....
Added logic to check if authority has v2.0 before modifying it
* Renaming GetAccessTokenOnBehalfOfUserAsync into GetAccessTokenForUserAsync
as the OnBehalfOfUser was telling too much about OBO, whereas in the case of a Web App this was not the OBO flow.
* Addressing PR feedback
# Conflicts:
#	1-WebApp-OIDC/1-2-AnyOrg/README-1-1-to-1-2.md
#	1-WebApp-OIDC/1-5-B2C/Startup.cs
#	1-WebApp-OIDC/1-5-B2C/WebApp-OpenIDConnect-DotNet.sln
#	2-WebApp-graph-user/2-1-Call-MSGraph/Properties/launchSettings.json
#	5-WebApp-AuthZ/5-1-Roles/README-incremental-instructions.md
#	Microsoft.Identity.Web/WebAppServiceCollectionExtensions.cs
…ns in the same class

Add AuthorityHelpers
Helper method to check if authority is V2
Helper method to build AAD or B2C AuthorityHelpers
Refactored AddSignIn so parameters shows in a logical order
Added B2C exclusive OIDC event handlers
Fixed 1-5 samples to use Microsoft.Identity.UI project
# Conflicts:
#	1-WebApp-OIDC/1-2-AnyOrg/README-1-1-to-1-2.md
#	2-WebApp-graph-user/2-1-Call-MSGraph/AspnetCoreWebApp-calls-Microsoft-Graph.sln
#	5-WebApp-AuthZ/5-1-Roles/README-incremental-instructions.md
#	Microsoft.Identity.Web/ClaimsPrincipalExtensions.cs
#	Microsoft.Identity.Web/TokenAcquisition.cs
#	Microsoft.Identity.Web/TokenCacheProviders/Session/MsalSessionTokenCacheProvider.cs
#	Microsoft.Identity.Web/WebAppServiceCollectionExtensions.cs
@TiagoBrenck TiagoBrenck added the do not merge PR not ready to merge yet label Jan 27, 2020
Copy link
Contributor

@jennyf19 jennyf19 left a comment

Choose a reason for hiding this comment

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

Thanks for the quick updates, @TiagoBrenck

@jennyf19
Copy link
Contributor

jennyf19 commented Jan 30, 2020

this comment is not valid anymore right? #Resolved


Refers to: Microsoft.Identity.Web/ClaimsPrincipalExtensions.cs:15 in 14dd663. [](commit_id = 14dd663, deletion_comment = False)

pmaytak and others added 3 commits January 31, 2020 16:52
Added B2C Password Reset Policy ID to app settings.
# Conflicts:
#	Microsoft.Identity.Web/AuthorizeForScopesAttribute.cs
jmprieur and others added 11 commits February 9, 2020 17:46
* Experiment for a B2C Web app calling a B2C Web API.
Needs more work.

* Test and fix B2C web app calls web api scenario
Fix issue in AadIssuerValidator when certains claims are not present (ex. policy) in the token
Fix bug w/scopes and scopeKeySection
Send "client_info=1" to request to get client info back from AAD B2C
Add ClientInfo class + methods to pull out the TenantId from the ClientInfo
Add full value to UserFlow as it was not picking up on short version
In TokenAcquisition, check first for b2c and then do null tenant and then tenant specific, was using the wrong authority for b2c previously
Fix bug in determining audience validation

* Fixing missing references

* Uncommenting a needed line

* Fixing a build break

* Fixing the configuration and a problem brought bad a by merge by jmprieur

* add uitid to the claims for b2c

* moving Web app calling Web API with B2C in own folder

* Reading the 4-1-MyOrg folder

* Update README.md

Co-authored-by: jennyf19 <jeferrie@microsoft.com>
- Removed DisallowsSameSiteNone from WebAppServiceCollectionExtensions because it got moved to another class
- Added edit profile button on login bar
- Fixed merge on AuthorizeForScopesAttribute
- Added options.TokenValidationParameters.NameClaimType = "name" on web api Startup to fix todo list
@TiagoBrenck TiagoBrenck removed the do not merge PR not ready to merge yet label Feb 19, 2020
@jmprieur jmprieur merged commit b1b0b4b into master Feb 19, 2020
@jmprieur
Copy link
Contributor

Thanks @TiagoBrenck @jennyf19 @kalyankrishna1 for this big achievement!

@jmprieur jmprieur deleted the jmprieur/removingUis branch February 21, 2020 18:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants