Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 0 additions & 58 deletions src/Microsoft.IdentityModel.JsonWebTokens/JsonWebToken.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -629,61 +626,6 @@ public Claim GetClaim(string key)
/// </summary>
internal IReadOnlyCollection<string> 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;
}
}

/// <summary>
/// Try to get a <see cref="Claim"/> representing the { key, 'value' } pair corresponding to the provided <paramref name="key"/>.
/// The value is obtained from the Payload.
Expand Down