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..8807853e1c 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 @@ -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 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.