Skip to content

Commit

Permalink
first round to fix issuer validator w/clouds
Browse files Browse the repository at this point in the history
  • Loading branch information
jennyf19 committed Jun 5, 2021
1 parent 34b45aa commit fd57c09
Show file tree
Hide file tree
Showing 13 changed files with 377 additions and 244 deletions.
1 change: 1 addition & 0 deletions src/Microsoft.Identity.Web/Constants/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public static class Constants
internal const string AzureADIssuerMetadataUrl = "https://login.microsoftonline.com/common/discovery/instance?authorization_endpoint=https://login.microsoftonline.com/common/oauth2/v2.0/authorize&api-version=1.1";
#pragma warning restore S1075 // URIs should not be hardcoded
internal const string FallbackAuthority = "https://login.microsoftonline.com/";
internal const string OidcEndpoint = "/.well-known/openid-configuration";

// RegisterValidAudience
internal const string Version = "ver";
Expand Down
1 change: 1 addition & 0 deletions src/Microsoft.Identity.Web/Constants/IDWebErrorMessage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,6 @@ internal static class IDWebErrorMessage
public const string InitializeAsyncIsObsolete = "IDW10801: Use Initialize instead. See https://aka.ms/ms-id-web/1.9.0. ";
public const string ReplyForbiddenWithWwwAuthenticateHeaderAsyncIsObsolete = "IDW10802: Use ReplyForbiddenWithWwwAuthenticateHeader instead. See https://aka.ms/ms-id-web/1.9.0. ";
public const string FromStoreWithThumprintIsObsolete = "IDW10803: Use FromStoreWithThumbprint instead, due to spelling error. ";
public const string AadIssuerValidatorIsObsolete = "IDW10804: Use MicrosoftIdentityIssuerValidator. ";
}
}
19 changes: 3 additions & 16 deletions src/Microsoft.Identity.Web/InstanceDiscovery/IssuerMetadata.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using System.Collections.Generic;
using System.Text.Json.Serialization;

namespace Microsoft.Identity.Web.InstanceDiscovery
Expand All @@ -12,21 +11,9 @@ namespace Microsoft.Identity.Web.InstanceDiscovery
internal class IssuerMetadata
{
/// <summary>
/// Tenant discovery endpoint.
/// Issuer associated with the OIDC endpoint.
/// </summary>
[JsonPropertyName(Constants.TenantDiscoveryEndpoint)]
public string? TenantDiscoveryEndpoint { get; set; }

/// <summary>
/// API Version.
/// </summary>
[JsonPropertyName(Constants.ApiVersion)]
public string? ApiVersion { get; set; }

/// <summary>
/// List of metadata associated with the endpoint.
/// </summary>
[JsonPropertyName(Constants.Metadata)]
public List<Metadata> Metadata { get; set; } = new List<Metadata>();
[JsonPropertyName("issuer")]
public string? Issuer { get; set; }
}
}
33 changes: 0 additions & 33 deletions src/Microsoft.Identity.Web/InstanceDiscovery/Metadata.cs

This file was deleted.

68 changes: 32 additions & 36 deletions src/Microsoft.Identity.Web/Microsoft.Identity.Web.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion src/Microsoft.Identity.Web/Resource/AadIssuerValidator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ namespace Microsoft.Identity.Web.Resource
/// <summary>
/// Generic class that validates token issuer from the provided Azure AD authority.
/// </summary>
[Obsolete(IDWebErrorMessage.AadIssuerValidatorIsObsolete, false)]
public class AadIssuerValidator
{
/// <summary>
Expand Down Expand Up @@ -40,7 +41,10 @@ public class AadIssuerValidator
/// <exception cref="ArgumentNullException"> if <paramref name="securityToken"/> is null.</exception>
/// <exception cref="ArgumentNullException"> if <paramref name="validationParameters"/> is null.</exception>
/// <exception cref="SecurityTokenInvalidIssuerException">if the issuer is invalid. </exception>
public string Validate(string actualIssuer, SecurityToken securityToken, TokenValidationParameters validationParameters)
public string Validate(
string actualIssuer,
SecurityToken securityToken,
TokenValidationParameters validationParameters)
{
if (string.IsNullOrEmpty(actualIssuer))
{
Expand Down
Loading

0 comments on commit fd57c09

Please sign in to comment.