Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

JsonWebTokenHandler to return the JsonWebToken on validation failure #1989

Merged
merged 5 commits into from
Jan 18, 2023
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
resolved review comments
  • Loading branch information
dannybtsai committed Jan 3, 2023
commit 92997abf75b4dd25e2ad7f8e6749c5cffa955c1a
Original file line number Diff line number Diff line change
@@ -427,6 +427,10 @@ public virtual ClaimsIdentity CreateClaimsIdentity(SecurityToken securityToken,
[DefaultValue(true)]
public bool IgnoreTrailingSlashWhenValidatingAudience { get; set; } = true;

/// <summary>
/// Gets or sets the flag that indicates whether to include the <see cref="SecurityToken"/> when the validation fails.
/// </summary>
public bool IncludeTokenOnFailedValidation { get; set; } = false;

/// <summary>
/// Gets or sets a delegate for validating the <see cref="SecurityKey"/> that signed the token.
@@ -865,10 +869,5 @@ public string RoleClaimType
/// The default is <c>null</c>.
/// </summary>
public IEnumerable<string> ValidTypes { get; set; }

/// <summary>
/// Gets or sets the flag that indicates whether to include the <see cref="SecurityToken"/> when the validation fails.
/// </summary>
public bool IncludeTokenOnFailedValidation { get; set; } = false;
}
}
10 changes: 5 additions & 5 deletions src/Microsoft.IdentityModel.Tokens/TokenValidationResult.cs
Original file line number Diff line number Diff line change
@@ -22,11 +22,6 @@ public class TokenValidationResult
private TokenValidationParameters _validationParameters;
private TokenHandler _tokenHandler;

/// <summary>
/// The <see cref="SecurityToken"/> to be returned when a validation fails.
/// </summary>
public SecurityToken TokenOnFailedValidation { get; internal set; }

/// <summary>
/// Creates an instance of <see cref="TokenValidationResult"/>
/// </summary>
@@ -147,6 +142,11 @@ public bool IsValid
/// </summary>
public SecurityToken SecurityToken { get; set; }

/// <summary>
/// The <see cref="SecurityToken"/> to be returned when validation fails.
/// </summary>
public SecurityToken TokenOnFailedValidation { get; internal set; }

/// <summary>
/// Gets or sets the <see cref="CallContext"/> that contains call information.
/// </summary>