-
Notifications
You must be signed in to change notification settings - Fork 13
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
JwsDescriptor.Payload setter weird behavior. #541
Comments
Please note that the It seems that the intent was (for the
|
This is "by design". These objects are designed for append-only, so The expected usage is: var descriptor = new JwsDescriptor(<any>, SignatureAlgorithm.HS256)
{
Header = new JwtHeader { { "One", "Header" } }
Payload = new JwtPayload { { "One", "Member" } }
} The goal is to keep the values of the predefined members, mostly for the header (like I do understand this is surprising, and the merging might be at another place. |
Ok. I understand... That's a miserable failure! I forgot to change my branch before investigating the init idea. Regardless of me being very bad at git, could you have a look at this commit? If you want I can close the current PR and recreate 2 different ones. |
Yes can please keep the current PR for the bug fix, and another PR for the |
Added init-only for |
Hello, I've seen that you have integrated the Payloald and Header setter. I have 2 remarks:
or:
/// <inheritdoc />
/// <remarks>This payload is never null.</remarks>
public override JwtPayload? Payload or:
/// <inheritdoc />
public override JwtPayload Payload
{
get => _payload;
#pragma warning disable CS8765 // Nullability of type of parameter doesn't match overridden member (possibly because of nullability attributes).
set
{
if (value is null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.value);
}
_payload = value;
}
#pragma warning restore CS8765 // Nullability of type of parameter doesn't match overridden member (possibly because of nullability attributes).
} |
Init-only has been removed from the
|
This unit test fails:
With this:
This is a rather surprising side effect. Considering the implementation (see below
_payload.CopyTo(value);
), I'm wondering if this is intentional or not...If its not, I can make a PR to fix this (including the above test).
The text was updated successfully, but these errors were encountered: