Skip to content

Commit 0180d17

Browse files
committed
Sync Microsoft.Identity.Web with the ASP.NET Core
Web app's content.
1 parent 85a2c44 commit 0180d17

File tree

7 files changed

+13
-13
lines changed

7 files changed

+13
-13
lines changed

Microsoft.Identity.Web/ClaimPrincipalExtension.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,10 @@ public static string GetDomainHint(this ClaimsPrincipal claimsPrincipal)
107107
/// <remarks>See https://docs.microsoft.com/en-us/azure/active-directory/develop/id-tokens#payload-claims </remarks>
108108
public static string GetDisplayName(this ClaimsPrincipal claimsPrincipal)
109109
{
110-
// Attempting the claims brought by a v2.0 token first
110+
// Attempting the claims brought by an Microsoft identity platform token first
111111
string displayName = claimsPrincipal.FindFirstValue(ClaimConstants.PreferredUserName);
112112

113-
// Otherwise falling back to the claims brought by a v1.0 token
113+
// Otherwise falling back to the claims brought by an Azure AD v1.0 token
114114
if (string.IsNullOrWhiteSpace(displayName))
115115
{
116116
displayName = claimsPrincipal.FindFirstValue(ClaimsIdentity.DefaultNameClaimType);

Microsoft.Identity.Web/Client/TokenAcquisition.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,9 +282,9 @@ public async Task RemoveAccount(RedirectContext context)
282282

283283
if (account != null)
284284
{
285-
this.UserTokenCacheProvider?.Clear(account.HomeAccountId.Identifier);
286-
287285
await app.RemoveAsync(account);
286+
287+
this.UserTokenCacheProvider?.Clear(user.GetMsalAccountId());
288288
}
289289
}
290290

Microsoft.Identity.Web/Microsoft.Identity.Web.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
<PackageReference Include="Microsoft.AspNetCore.App" />
99
<PackageReference Include="Microsoft.AspNetCore.Authentication.AzureAD.UI" Version="2.2.0" />
1010
<PackageReference Include="Microsoft.AspNetCore.Authentication.AzureADB2C.UI" Version="2.2.0" />
11-
<PackageReference Include="Microsoft.Identity.Client" Version="4.1.0" />
11+
<PackageReference Include="Microsoft.Identity.Client" Version="4.2.1" />
1212
</ItemGroup>
1313
</Project>

Microsoft.Identity.Web/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ The library contains helper classes to:
2222
![image](https://user-images.githubusercontent.com/13203188/53899064-a100ab80-4039-11e9-8869-fa9cffcd345a.png)
2323
2424
- Protect Web resources (in the `Resources` folder)
25-
- `AadIssuerValidator` is used to validate the issuer in multi-tenant applications, taking into account the aliases for authorities exising in Azure AD. This class works both for Azure AD v1.0 and Microsoft identity platform web resources. You should not need to use it directly, as it's used by `AddAzureAdV2Authentication`
25+
- `AadIssuerValidator` is used to validate the issuer in multi-tenant applications, taking into account the aliases for authorities exising in Azure AD. This class works both for Azure AD (v1.0) and Microsoft identity platform (v2.0) web resources. You should not need to use it directly, as it's used by `AddAzureAdV2Authentication`
2626
- `OpenIdConnectMiddlewareDiagnostics` helps you understand what happens in the Open Id Connect Middleware. This is a diagnostics class that can help you troubleshooting your Web apps.
2727
- `ClaimsPrincipalExtensions` provides a set of extension methods on `ClaimsPrincipal` helping getting information from the signed-in user. It's used in the other classes of the libraries.
2828

Microsoft.Identity.Web/Resource/AadIssuerValidator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ public string Validate(string actualIssuer, SecurityToken securityToken, TokenVa
125125

126126
string tenantId = GetTenantIdFromToken(securityToken);
127127
if (string.IsNullOrWhiteSpace(tenantId))
128-
throw new SecurityTokenInvalidIssuerException("Neither `tid` nor `tenantId` claim is present in the token obtained from Microsoft Identity Platform.");
128+
throw new SecurityTokenInvalidIssuerException("Neither `tid` nor `tenantId` claim is present in the token obtained from Microsoft identity platform.");
129129

130130
if (validationParameters.ValidIssuers != null)
131131
foreach (var validIssuerTemplate in validationParameters.ValidIssuers)

Microsoft.Identity.Web/StartupHelpers.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ namespace Microsoft.Identity.Web
3838
public static class StartupHelpers
3939
{
4040
/// <summary>
41-
/// Add authentication with Microsoft identity platform (v2.0).
41+
/// Add authentication with Microsoft identity platform.
4242
/// This expects the configuration files will have a section named "AzureAD"
4343
/// </summary>
4444
/// <param name="services">Service collection to which to add this authentication scheme</param>
@@ -70,7 +70,7 @@ public static IServiceCollection AddAzureAdV2Authentication(this IServiceCollect
7070

7171
// Set the nameClaimType to be preferred_username.
7272
// This change is needed because certain token claims from Azure AD V1 endpoint
73-
// (on which the original .NET core template is based) are different than V2 endpoint.
73+
// (on which the original .NET core template is based) are different than Microsoft identity platform endpoint.
7474
// For more details see [ID Tokens](https://docs.microsoft.com/en-us/azure/active-directory/develop/id-tokens)
7575
// and [Access Tokens](https://docs.microsoft.com/en-us/azure/active-directory/develop/access-tokens)
7676
options.TokenValidationParameters.NameClaimType = "preferred_username";

Microsoft.Identity.Web/WebApiStartupHelpers.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ namespace Microsoft.Identity.Web
4343
public static class WebApiStartupHelpers
4444
{
4545
/// <summary>
46-
/// Protects the Web API with Microsoft identity platform (v2.0)
46+
/// Protects the Web API with Microsoft identity platform
4747
/// This expects the configuration files will have a section named "AzureAD"
4848
/// </summary>
4949
/// <param name="services">Service collection to which to add this authentication scheme</param>
@@ -57,13 +57,13 @@ public static IServiceCollection AddProtectWebApiWithMicrosoftIdentityPlatformV2
5757
// Add session if you are planning to use session based token cache , .AddSessionTokenCaches()
5858
services.AddSession();
5959

60-
// Change the authentication configuration to accommodate the identity platform endpoint.
60+
// Change the authentication configuration to accommodate the Microsoft identity platform endpoint.
6161
services.Configure<JwtBearerOptions>(AzureADDefaults.JwtBearerAuthenticationScheme, options =>
6262
{
6363
// Reinitialize the options as this has changed to JwtBearerOptions to pick configuration values for attributes unique to JwtBearerOptions
6464
configuration.Bind("AzureAd", options);
6565

66-
// This is an identity platform Web API
66+
// This is an Microsoft identity platform Web API
6767
options.Authority += "/v2.0";
6868

6969
// The valid audiences are both the Client ID (options.Audience) and api://{ClientID}
@@ -105,7 +105,7 @@ public static IServiceCollection AddProtectWebApiWithMicrosoftIdentityPlatformV2
105105
}
106106

107107
/// <summary>
108-
/// Protects the Web API with Microsoft identity platform (v2.0)
108+
/// Protects the Web API with Microsoft identity platform
109109
/// This supposes that the configuration files have a section named "AzureAD"
110110
/// </summary>
111111
/// <param name="services">Service collection to which to add authentication</param>

0 commit comments

Comments
 (0)