Skip to content

Commit

Permalink
Merge branch 'dev7x' into jennyf/TestsViaGitHubAction
Browse files Browse the repository at this point in the history
  • Loading branch information
jennyf19 committed Jul 27, 2023
2 parents 27bffe8 + fe24a61 commit a26f759
Show file tree
Hide file tree
Showing 370 changed files with 417 additions and 72,508 deletions.
60 changes: 0 additions & 60 deletions .github/workflows/codeql-analysis.yml

This file was deleted.

10 changes: 0 additions & 10 deletions Wilson.sln
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.IdentityModel.Tes
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.IdentityModel.Logging", "src\Microsoft.IdentityModel.Logging\Microsoft.IdentityModel.Logging.csproj", "{E4E6D0ED-12CB-4C01-A4C1-4F60D10E2304}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "CrossVersionTokenValidation.Test", "CrossVersionTokenValidation.Test", "{310A34D3-8685-4355-8590-84351B5223BC}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.IdentityModel.JsonWebTokens", "src\Microsoft.IdentityModel.JsonWebTokens\Microsoft.IdentityModel.JsonWebTokens.csproj", "{DBF58792-25DF-4B6E-866C-77A0BC5AB81B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CrossVersionTokenValidation.Tests", "test\CrossVersionTokenValidation.Tests\CrossVersionTokenValidation.Tests.csproj", "{7E7CCB59-541E-48DA-9044-2D6C4AD8E509}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Extensions", "Extensions", "{EB14B99B-2255-45BC-BF14-E488DCD4A4BA}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Extensions", "Extensions", "{B961CF69-0DE6-4B9F-9473-9F669365BD62}"
Expand Down Expand Up @@ -187,10 +183,6 @@ Global
{DBF58792-25DF-4B6E-866C-77A0BC5AB81B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DBF58792-25DF-4B6E-866C-77A0BC5AB81B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DBF58792-25DF-4B6E-866C-77A0BC5AB81B}.Release|Any CPU.Build.0 = Release|Any CPU
{7E7CCB59-541E-48DA-9044-2D6C4AD8E509}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7E7CCB59-541E-48DA-9044-2D6C4AD8E509}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7E7CCB59-541E-48DA-9044-2D6C4AD8E509}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7E7CCB59-541E-48DA-9044-2D6C4AD8E509}.Release|Any CPU.Build.0 = Release|Any CPU
{987772FA-BA24-4EF4-9B58-3DA78FFD61DD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{987772FA-BA24-4EF4-9B58-3DA78FFD61DD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{987772FA-BA24-4EF4-9B58-3DA78FFD61DD}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down Expand Up @@ -274,9 +266,7 @@ Global
{BDB0A526-FA17-44CF-80D6-4A64F7E6CD7E} = {8905D2E3-4499-4A86-BF3E-F098F228DD59}
{3C338E2D-C1D8-4517-8C52-A86A9F0C8281} = {8905D2E3-4499-4A86-BF3E-F098F228DD59}
{E4E6D0ED-12CB-4C01-A4C1-4F60D10E2304} = {BD2706C5-6C57-484D-89C8-A0CF5F8E3D19}
{310A34D3-8685-4355-8590-84351B5223BC} = {8905D2E3-4499-4A86-BF3E-F098F228DD59}
{DBF58792-25DF-4B6E-866C-77A0BC5AB81B} = {BD2706C5-6C57-484D-89C8-A0CF5F8E3D19}
{7E7CCB59-541E-48DA-9044-2D6C4AD8E509} = {310A34D3-8685-4355-8590-84351B5223BC}
{EB14B99B-2255-45BC-BF14-E488DCD4A4BA} = {BD2706C5-6C57-484D-89C8-A0CF5F8E3D19}
{B961CF69-0DE6-4B9F-9473-9F669365BD62} = {8905D2E3-4499-4A86-BF3E-F098F228DD59}
{987772FA-BA24-4EF4-9B58-3DA78FFD61DD} = {B961CF69-0DE6-4B9F-9473-9F669365BD62}
Expand Down
49 changes: 49 additions & 0 deletions build/CodeCoverage.runsettings
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>

<!-- Customised run settings file to exclude test assemblies from coverage.
See https://msdn.microsoft.com/en-us/library/jj159530.aspx for more info. -->

<!-- File name extension must be .runsettings -->
<RunSettings>
<DataCollectionRunSettings>
<DataCollectors>
<DataCollector friendlyName="Code Coverage" uri="datacollector://Microsoft/CodeCoverage/2.0" assemblyQualifiedName="Microsoft.VisualStudio.Coverage.DynamicCoverageDataCollector, Microsoft.VisualStudio.TraceCollector, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<Configuration>
<CodeCoverage>

<!--
About include/exclude lists:
Empty "Include" clauses imply all; empty "Exclude" clauses imply none.
Each element in the list is a regular expression (ECMAScript syntax). See http://msdn.microsoft.com/library/2k3te2cs.aspx.
An item must first match at least one entry in the include list to be included.
Included items must then not match any entries in the exclude list to remain included.
-->

<!-- Match assembly file paths: -->
<ModulePaths>
<Include>
<ModulePath>.*\microsoft.identitymodel.abstractions.dll</ModulePath>
<ModulePath>.*\microsoft.identitymodel.jsonwebtokens.dll</ModulePath>
<ModulePath>.*\microsoft.identitymodel.keyvaultextensions.dll</ModulePath>
<ModulePath>.*\microsoft.identitymodel.logging.dll</ModulePath>
<ModulePath>.*\microsoft.identitymodel.loggingextensions.dll</ModulePath>
<ModulePath>.*\microsoft.identitymodel.managedkeyvaultsecuritykey.dll</ModulePath>
<ModulePath>.*\microsoft.identitymodel.protocols.openidconnect.dll</ModulePath>
<ModulePath>.*\microsoft.identitymodel.protocols.signedhttprequest.dll</ModulePath>
<ModulePath>.*\microsoft.identitymodel.protocols.wsfederation.dll</ModulePath>
<ModulePath>.*\microsoft.identitymodel.protocols.dll</ModulePath>
<ModulePath>.*\microsoft.identitymodel.testextensions.dll</ModulePath>
<ModulePath>.*\microsoft.identitymodel.tokens.saml.dll</ModulePath>
<ModulePath>.*\microsoft.identitymodel.tokens.dll</ModulePath>
<ModulePath>.*\microsoft.identitymodel.validators.dll</ModulePath>
<ModulePath>.*\microsoft.identitymodel.xml.dll</ModulePath>
<ModulePath>.*\system.identitymodel.tokens.jwt.dll</ModulePath>
</Include>
</ModulePaths>

</CodeCoverage>
</Configuration>
</DataCollector>
</DataCollectors>
</DataCollectionRunSettings>
</RunSettings>
7 changes: 6 additions & 1 deletion build/common.props
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<Project>

<Import Project="apiCompat.props" />
<Import Project="dependencies.props" />
<Import Project="targets.props" />
Expand Down Expand Up @@ -31,7 +32,7 @@
<TargetFrameworks Condition=" '$(OS)' == 'Windows_NT' ">$(SrcTargets)</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">$(SrcStandardTargets)</TargetFrameworks>
<NetStandardImplicitPackageVersion>$(NetStandardVersion)</NetStandardImplicitPackageVersion>
<LangVersion>latest</LangVersion>
<LangVersion>7.3</LangVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(TF_BUILD)' == 'true'">
Expand All @@ -47,4 +48,8 @@
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="$(MicrosoftSourceLinkGitHubVersion)" PrivateAssets="All"/>
</ItemGroup>

<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="$(NewtonsoftVersion)" />
</ItemGroup>

</Project>
1 change: 1 addition & 0 deletions build/commonTest.props
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(MicrosoftNETTestSdkVersion)" />
<PackageReference Include="Newtonsoft.Json" Version="$(NewtonsoftVersion)" />
<PackageReference Include="xunit.runner.console" Version="$(XunitVersion)" />
<PackageReference Include="xunit.runner.visualstudio" Version="$(XunitVersion)" />
<PackageReference Include="xunit" Version="$(XunitVersion)" />
Expand Down
4 changes: 3 additions & 1 deletion build/dependencies.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@
<MicrosoftCSharpVersion>4.5.0</MicrosoftCSharpVersion>
<MicrosoftSourceLinkGitHubVersion>1.0.0</MicrosoftSourceLinkGitHubVersion>
<NetStandardVersion>2.0.3</NetStandardVersion>
<NewtonsoftVersion>13.0.3</NewtonsoftVersion>
<SystemMemoryVersion>4.5.5</SystemMemoryVersion>
<SystemSecurityCryptographyCngVersion>4.5.0</SystemSecurityCryptographyCngVersion>
<SystemTextJson>4.7.2</SystemTextJson>
<SystemTextEncodingsWeb>4.7.2</SystemTextEncodingsWeb>
<SystemTextJson>4.7.2</SystemTextJson>
</PropertyGroup>

</Project>
8 changes: 4 additions & 4 deletions build/dependenciesTest.props
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<Project>
<PropertyGroup>
<DotNetCoreAppRuntimeVersion>2.1.30</DotNetCoreAppRuntimeVersion>
<NetStandardVersion>2.0.3</NetStandardVersion>
<MicrosoftAzureKeyVaultCryptographyVersion>2.0.5</MicrosoftAzureKeyVaultCryptographyVersion>
<MicrosoftDotNetXUnitExtensionsVersion>2.4.0-prerelease-63213-02</MicrosoftDotNetXUnitExtensionsVersion>
<MicrosoftIdentityModelProtocolExtensionsVersion>1.0.4.403061554</MicrosoftIdentityModelProtocolExtensionsVersion>
<MicrosoftNETTestSdkVersion>16.10.0</MicrosoftNETTestSdkVersion>
<SystemIdentityModelTokensJwtVersion4x>4.0.4.403061554</SystemIdentityModelTokensJwtVersion4x>
<NetStandardVersion>2.0.3</NetStandardVersion>
<NewtonsoftVersion>13.0.3</NewtonsoftVersion>
<SystemSecurityClaimsVersion>4.3.0</SystemSecurityClaimsVersion>
<XunitVersion>2.4.0</XunitVersion>
</PropertyGroup>
</Project>
</Project>
1 change: 0 additions & 1 deletion buildConfiguration.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
<project name="Microsoft.IdentityModel.LoggingExtensions" />
</src>
<test>
<project name="CrossVersionTokenValidation.Tests" test="yes"/>
<project name="Microsoft.IdentityModel.Logging.Tests" test="yes"/>
<project name="Microsoft.IdentityModel.TestUtils" test="no" />
<project name="Microsoft.IdentityModel.JsonWebTokens.Tests" test="yes" />
Expand Down
12 changes: 6 additions & 6 deletions src/Microsoft.IdentityModel.Abstractions/ITelemetryClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@ void TrackEvent(
/// <param name="guidProperties">Key value pair of Guids to long with the event.</param>
void TrackEvent(
string eventName,
IDictionary<string, string>? stringProperties = null,
IDictionary<string, long>? longProperties = null,
IDictionary<string, bool>? boolProperties = null,
IDictionary<string, DateTime>? dateTimeProperties = null,
IDictionary<string, double>? doubleProperties = null,
IDictionary<string, Guid>? guidProperties = null);
IDictionary<string, string> stringProperties = null,
IDictionary<string, long> longProperties = null,
IDictionary<string, bool> boolProperties = null,
IDictionary<string, DateTime> dateTimeProperties = null,
IDictionary<string, double> doubleProperties = null,
IDictionary<string, Guid> guidProperties = null);
}
}
4 changes: 2 additions & 2 deletions src/Microsoft.IdentityModel.Abstractions/LogEntry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ public class LogEntry
/// <summary>
/// Message to be logged.
/// </summary>
public string? Message { get; set; }
public string Message { get; set; }

/// <summary>
/// A unique identifier for a request that can help with diagnostics across components.
/// </summary>
/// <remarks>
/// Also referred to as ActivityId in Microsoft.IdentityModel.Tokens.CallContext.
/// </remarks>
public string? CorrelationId { get; set; }
public string CorrelationId { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
<PackageId>Microsoft.IdentityModel.Abstractions</PackageId>
<PackageTags>.NET;Windows;Authentication;Identity;Abstractions</PackageTags>
<IsTrimmable>true</IsTrimmable>
<Nullable>enable</Nullable>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)'=='Debug'">
Expand Down
14 changes: 6 additions & 8 deletions src/Microsoft.IdentityModel.Abstractions/NullTelemetryClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ public class NullTelemetryClient : ITelemetryClient
/// <remarks>
/// Private constructor to prevent the default constructor being exposed.
/// </remarks>
#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
private NullTelemetryClient() { }
#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.

/// <inheritdoc />
public bool IsEnabled() => false;
Expand All @@ -50,12 +48,12 @@ public void TrackEvent(TelemetryEventDetails eventDetails)
/// <inheritdoc/>
public void TrackEvent(
string eventName,
IDictionary<string, string>? stringProperties = null,
IDictionary<string, long>? longProperties = null,
IDictionary<string, bool>? boolProperties = null,
IDictionary<string, DateTime>? dateTimeProperties = null,
IDictionary<string, double>? doubleProperties = null,
IDictionary<string, Guid>? guidProperties = null)
IDictionary<string, string> stringProperties = null,
IDictionary<string, long> longProperties = null,
IDictionary<string, bool> boolProperties = null,
IDictionary<string, DateTime> dateTimeProperties = null,
IDictionary<string, double> doubleProperties = null,
IDictionary<string, Guid> guidProperties = null)
{
// no-op
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public abstract class TelemetryEventDetails
/// <summary>
/// Name of the telemetry event, should be unique between events.
/// </summary>
public virtual string? Name { get; set; }
public virtual string Name { get; set; }

/// <summary>
/// Properties which describe the event.
Expand Down
17 changes: 10 additions & 7 deletions src/Microsoft.IdentityModel.JsonWebTokens/Json/JsonClaimSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
using System.Globalization;
using System.Security.Claims;
using System.Text.Json;
using Microsoft.IdentityModel.Json.Linq;
using Microsoft.IdentityModel.Logging;
using Microsoft.IdentityModel.Tokens;
using Newtonsoft.Json.Linq;

namespace Microsoft.IdentityModel.JsonWebTokens
{
Expand All @@ -22,17 +22,20 @@ internal class JsonClaimSet

internal JsonClaimSet(JsonDocument jsonDocument)
{
RootElement = jsonDocument.RootElement;
// This method is assuming ownership of the JsonDocument, which is backed by one or more ArrayPool arrays.
// We need to dispose of it to avoid leaking arrays from the pool. To achieve that, we clone the root element,
// which will result in a new JsonElement being created that's not tied to the original and that's not backed by
// ArrayPool memory, after which point we can dispose of the original to return the array(s) to the pool.
RootElement = jsonDocument.RootElement.Clone();
jsonDocument.Dispose();
}

internal JsonClaimSet(byte[] jsonBytes)
internal JsonClaimSet(byte[] jsonBytes) : this(JsonDocument.Parse(jsonBytes))
{
RootElement = JsonDocument.Parse(jsonBytes).RootElement;
}

internal JsonClaimSet(string json)
internal JsonClaimSet(string json) : this(JsonDocument.Parse(json))
{
RootElement = JsonDocument.Parse(json).RootElement;
}

internal JsonElement RootElement { get; }
Expand Down Expand Up @@ -230,7 +233,7 @@ internal DateTime GetDateTime(string key)
if (!RootElement.TryGetProperty(key, out JsonElement jsonElement))
return DateTime.MinValue;

return EpochTime.DateTime(Convert.ToInt64(Math.Truncate(Convert.ToDouble(ParseTimeValue(key, jsonElement), CultureInfo.InvariantCulture))));
return EpochTime.DateTime(Convert.ToInt64(Math.Truncate((double)ParseTimeValue(key, jsonElement))));
}

internal T GetValue<T>(string key)
Expand Down
7 changes: 4 additions & 3 deletions src/Microsoft.IdentityModel.JsonWebTokens/JsonWebToken.cs
Original file line number Diff line number Diff line change
Expand Up @@ -605,9 +605,10 @@ public IEnumerable<string> Audiences
if (Payload.TryGetValue(JwtRegisteredClaimNames.Aud, out JsonElement audiences))
{
if (audiences.ValueKind == JsonValueKind.String)
_audiences = new List<string> { audiences.GetString() };

if (audiences.ValueKind == JsonValueKind.Array)
{
_audiences.Add(audiences.GetString());
}
else if (audiences.ValueKind == JsonValueKind.Array)
{
foreach (JsonElement jsonElement in audiences.EnumerateArray())
_audiences.Add(jsonElement.ToString());
Expand Down
Loading

0 comments on commit a26f759

Please sign in to comment.