From e6d316eccb67972e24deae30a7aeca6ed195a21e Mon Sep 17 00:00:00 2001 From: Keegan Date: Fri, 3 Jan 2025 13:03:14 -0800 Subject: [PATCH 1/3] Removed unused property on JsonWebToken (#3072) --- .../JsonWebToken.cs | 58 ------------------- 1 file changed, 58 deletions(-) diff --git a/src/Microsoft.IdentityModel.JsonWebTokens/JsonWebToken.cs b/src/Microsoft.IdentityModel.JsonWebTokens/JsonWebToken.cs index 48af759d86..985836f1c4 100644 --- a/src/Microsoft.IdentityModel.JsonWebTokens/JsonWebToken.cs +++ b/src/Microsoft.IdentityModel.JsonWebTokens/JsonWebToken.cs @@ -19,9 +19,6 @@ public partial class JsonWebToken : SecurityToken { internal const string ClassName = "Microsoft.IdentityModel.JsonWebTokens.JsonWebToken"; - private ClaimsIdentity _claimsIdentity; - private bool _wasClaimsIdentitySet; - private string _act; private string _authenticationTag; private string _ciphertext; @@ -629,61 +626,6 @@ public Claim GetClaim(string key) /// internal IReadOnlyCollection PayloadClaimNames => Payload._jsonClaims.Keys; - internal ClaimsIdentity ClaimsIdentity - { - get - { - if (!_wasClaimsIdentitySet) - { - _wasClaimsIdentitySet = true; - string actualIssuer = ActualIssuer ?? Issuer; - - foreach (Claim claim in Claims) - { - string claimType = claim.Type; - if (claimType == ClaimTypes.Actor) - { - if (_claimsIdentity.Actor != null) - throw LogHelper.LogExceptionMessage(new InvalidOperationException(LogHelper.FormatInvariant(LogMessages.IDX14112, LogHelper.MarkAsNonPII(JwtRegisteredClaimNames.Actort), claim.Value))); - -#pragma warning disable CA1031 // Do not catch general exception types - try - { - JsonWebToken actorToken = new JsonWebToken(claim.Value); - _claimsIdentity.Actor = ActorClaimsIdentity; - } - catch - { - - } -#pragma warning restore CA1031 // Do not catch general exception types - } - - if (claim.Properties.Count == 0) - { - _claimsIdentity.AddClaim(new Claim(claimType, claim.Value, claim.ValueType, actualIssuer, actualIssuer, _claimsIdentity)); - } - else - { - Claim newClaim = new Claim(claimType, claim.Value, claim.ValueType, actualIssuer, actualIssuer, _claimsIdentity); - - foreach (var kv in claim.Properties) - newClaim.Properties[kv.Key] = kv.Value; - - _claimsIdentity.AddClaim(newClaim); - } - } - } - - return _claimsIdentity; - } - - set - { - _claimsIdentity = value; - } - } - /// /// Try to get a representing the { key, 'value' } pair corresponding to the provided . /// The value is obtained from the Payload. From f70de659ab8ba6eb927e83f84ced2d5ff96a3593 Mon Sep 17 00:00:00 2001 From: Keegan Date: Sat, 4 Jan 2025 14:23:01 -0800 Subject: [PATCH 2/3] Update setup dotnet actions (#3074) * Needed for .net cdn change see https://github.com/dotnet/core/issues/9671 and: https://github.com/AzureAD/microsoft-identity-web/pull/3175 * Update codeql action to setup .NET 9 --- .github/workflows/aot-check.yml | 2 +- .github/workflows/codeql-analysis.yml | 5 +++++ .github/workflows/dotnetcore.yml | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/aot-check.yml b/.github/workflows/aot-check.yml index 911da7f712..a9d20a0eba 100644 --- a/.github/workflows/aot-check.yml +++ b/.github/workflows/aot-check.yml @@ -23,7 +23,7 @@ jobs: fetch-depth: 1 - name: Setup .NET 9.0.x - uses: actions/setup-dotnet@v4.1.0 + uses: actions/setup-dotnet@v4 with: dotnet-version: 9.0.x diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 85b9755976..345bf87488 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -26,6 +26,11 @@ jobs: with: fetch-depth: 2 + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 9.0.x + # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL uses: github/codeql-action/init@v3 diff --git a/.github/workflows/dotnetcore.yml b/.github/workflows/dotnetcore.yml index 16328cc5d0..cffc3d5bba 100644 --- a/.github/workflows/dotnetcore.yml +++ b/.github/workflows/dotnetcore.yml @@ -35,7 +35,7 @@ jobs: uses: actions/checkout@v4.1.1 - name: Setup .NET 9.x - uses: actions/setup-dotnet@v4.1.0 + uses: actions/setup-dotnet@v4 with: dotnet-version: 9.x From fd9be465dbaa6a863e5e4132951095132cb53328 Mon Sep 17 00:00:00 2001 From: jennyf19 Date: Sun, 5 Jan 2025 11:00:32 -0800 Subject: [PATCH 3/3] fixed #2983 and re-add code coverage comments to PRs (#3076) --- .github/workflows/dotnetcore.yml | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/.github/workflows/dotnetcore.yml b/.github/workflows/dotnetcore.yml index cffc3d5bba..8807853e1c 100644 --- a/.github/workflows/dotnetcore.yml +++ b/.github/workflows/dotnetcore.yml @@ -49,28 +49,27 @@ jobs: - name: Create code coverage report run: | dotnet tool install -g dotnet-reportgenerator-globaltool --version 5.4.1 - reportgenerator -reports:./**/coverage.cobertura.xml -targetdir:CodeCoverage -reporttypes:'MarkdownSummaryGithub;Cobertura' + reportgenerator -reports:./**/coverage.cobertura.xml -targetdir:CodeCoverage -reporttypes:'MarkdownSummaryGithub;Cobertura' -filefilters:'+src/**/*.cs' - name: Write coverage to job summary shell: bash run: | cat CodeCoverage/SummaryGithub.md >> $GITHUB_STEP_SUMMARY - # Temporarily disable commenting the coverage report - # echo "COMMENT_CONTENT_ENV_VAR<> $GITHUB_ENV - # echo $(cat CodeCoverage/SummaryGithub.md) >> $GITHUB_ENV - # echo "EOF" >> $GITHUB_ENV + echo "COMMENT_CONTENT_ENV_VAR<> $GITHUB_ENV + echo $(cat CodeCoverage/SummaryGithub.md) >> $GITHUB_ENV + echo "EOF" >> $GITHUB_ENV - # - name: Comment coverage in PR - # uses: actions/github-script@v7 - # id: comment - # with: - # script: | - # github.rest.issues.createComment({ - # issue_number: context.issue.number, - # owner: context.repo.owner, - # repo: context.repo.repo, - # body: process.env.COMMENT_CONTENT_ENV_VAR - # }) + - name: Comment coverage in PR + uses: actions/github-script@v7 + id: comment + with: + script: | + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: process.env.COMMENT_CONTENT_ENV_VAR + }) # Run baseline package validation - name: Pack