Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Lazily initialize TokenValidationParameters.InstancePropertyBag #2160

Merged
merged 1 commit into from
Jul 26, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ public class TokenValidationParameters
private TimeSpan _clockSkew = DefaultClockSkew;
private string _nameClaimType = ClaimsIdentity.DefaultNameClaimType;
private string _roleClaimType = ClaimsIdentity.DefaultRoleClaimType;
private Dictionary<string, object> _instancePropertyBag;

/// <summary>
/// This is the default value of <see cref="ClaimsIdentity.AuthenticationType"/> when creating a <see cref="ClaimsIdentity"/>.
Expand Down Expand Up @@ -483,7 +484,7 @@ public virtual ClaimsIdentity CreateClaimsIdentity(SecurityToken securityToken,
/// Gets a <see cref="IDictionary{String, Object}"/> that is unique to this instance.
/// Calling <see cref="Clone"/> will result in a new instance of this IDictionary.
/// </summary>
public IDictionary<string, object> InstancePropertyBag { get; } = new Dictionary<string, object>();
public IDictionary<string, object> InstancePropertyBag => _instancePropertyBag ??= new Dictionary<string, object>();

/// <summary>
/// Gets a value indicating if <see cref="Clone"/> was called to obtain this instance.
Expand Down