Update OpenIddictParameter
to offer ImmutableArray<string>
conversions instead of string[]
and clone JsonNode
objects to guarantee immutability
#2271
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR introduces the following changes:
OpenIddictMessage
/OpenIddictParameter
constructors and static operators usingstring?[]?
objects by equivalents usingImmutableArray<string?>
orImmutableArray<string?>?
.OpenIddictRequest.Audiences
andOpenIddictRequest.Resources
properties have been updated to useImmutableArray<string?>?
instead ofstring?[]?
, which will fully users from trying to do unsupported things likecontext.Request.Audiences[2] = "overridden audience"
(which may or may not currently work depending on the actual CLR type of the parameter value).JsonNode
instances are now cloned byOpenIddictParameter
's constructor and cloned by theJsonNode?
conversion operator.OpenIddictParameter.Value
property and replaces it by a newOpenIddictParameter.GetRawValue()
to discourage using this very-low-level API.GetDestinations()
/SetDestinations()
now useImmutableDictionary<string, ImmutableArray<string>>
instead ofImmutableDictionary<string, string[]>
for consistency with the previous changes.OpenIddictParameter
structure was updated to use recently-introduced APIs likeJsonNode.DeepEquals()
,JsonElement.DeepEquals()
orJsonElement.GetPropertyCount()
.StringValues
conversion operators have been added to theOpenIddictParameter
primitive.OpenIddictRequest.Claims
andOpenIddictRequest.Registration
properties are now of typeJsonObject
instead ofJsonElement
, which should make these properties easier to use.