diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2d0414d0..2431f12c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -45,7 +45,7 @@ jobs: dotnet-version: | 6.0.418 7.0.405 - 8.0.101 + 8.0.200 # Arcade only allows the revision to contain up to two characters, and GitHub Actions does not roll-over # build numbers every day like Azure DevOps does. To balance these two requirements, set the official @@ -105,7 +105,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v3 with: - dotnet-version: '8.0.101' + dotnet-version: '8.0.200' - name: Validate NuGet packages shell: pwsh diff --git a/Directory.Build.targets b/Directory.Build.targets index 7923ee0a..311eb9c9 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -117,7 +117,6 @@ $(DefineConstants);SUPPORTS_HTTP_CLIENT_RESILIENCE - $(DefineConstants);SUPPORTS_IMMUTABLE_COLLECTIONS_MARSHAL $(DefineConstants);SUPPORTS_TIME_PROVIDER diff --git a/global.json b/global.json index 271acbdc..650a86dd 100644 --- a/global.json +++ b/global.json @@ -1,12 +1,12 @@ { "sdk": { - "version": "8.0.101", + "version": "8.0.200", "allowPrerelease": true, "rollForward": "major" }, "tools": { - "dotnet": "8.0.101", + "dotnet": "8.0.200", "runtimes": { "aspnetcore": [ diff --git a/shared/OpenIddict.Extensions/OpenIddictPolyfills.cs b/shared/OpenIddict.Extensions/OpenIddictPolyfills.cs deleted file mode 100644 index de45b9b6..00000000 --- a/shared/OpenIddict.Extensions/OpenIddictPolyfills.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System.Collections.Immutable; -using System.Runtime.CompilerServices; - -#if !SUPPORTS_IMMUTABLE_COLLECTIONS_MARSHAL -namespace System.Runtime.InteropServices; - -internal static class ImmutableCollectionsMarshal -{ - public static ImmutableArray AsImmutableArray(T[] array) => Unsafe.As>(ref array); -} -#endif \ No newline at end of file diff --git a/src/OpenIddict.Abstractions/OpenIddictExceptions.cs b/src/OpenIddict.Abstractions/OpenIddictExceptions.cs index 6e65c16b..5273f53f 100644 --- a/src/OpenIddict.Abstractions/OpenIddictExceptions.cs +++ b/src/OpenIddict.Abstractions/OpenIddictExceptions.cs @@ -109,7 +109,7 @@ public static class OpenIddictExceptions /// /// The exception message. public ValidationException(string? message) - : this(message, []) + : this(message, ImmutableArray.Empty) { } diff --git a/src/OpenIddict.Abstractions/Primitives/OpenIddictExtensions.cs b/src/OpenIddict.Abstractions/Primitives/OpenIddictExtensions.cs index 033a7bc1..c81d09bb 100644 --- a/src/OpenIddict.Abstractions/Primitives/OpenIddictExtensions.cs +++ b/src/OpenIddict.Abstractions/Primitives/OpenIddictExtensions.cs @@ -510,7 +510,7 @@ public static class OpenIddictExtensions if (string.IsNullOrEmpty(destinations)) { - return []; + return ImmutableArray.Empty; } using var document = JsonDocument.Parse(destinations); @@ -620,7 +620,7 @@ public static class OpenIddictExtensions /// The instance. /// The destinations. public static Claim SetDestinations(this Claim claim, IEnumerable? destinations) - => claim.SetDestinations(destinations?.ToImmutableArray() ?? []); + => claim.SetDestinations(destinations?.ToImmutableArray() ?? ImmutableArray.Empty); /// /// Adds specific destinations to a claim. @@ -628,7 +628,7 @@ public static class OpenIddictExtensions /// The instance. /// The destinations. public static Claim SetDestinations(this Claim claim, params string[]? destinations) - => claim.SetDestinations(destinations?.ToImmutableArray() ?? []); + => claim.SetDestinations(destinations?.ToImmutableArray() ?? ImmutableArray.Empty); /// /// Gets the destinations associated with all the claims of the given identity. @@ -2868,7 +2868,7 @@ public static class OpenIddictExtensions /// The audiences to store. /// The claims identity. public static ClaimsIdentity SetAudiences(this ClaimsIdentity identity, IEnumerable? audiences) - => identity.SetAudiences(audiences?.ToImmutableArray() ?? []); + => identity.SetAudiences(audiences?.ToImmutableArray() ?? ImmutableArray.Empty); /// /// Sets the audiences list in the claims principal. @@ -2878,7 +2878,7 @@ public static class OpenIddictExtensions /// The audiences to store. /// The claims principal. public static ClaimsPrincipal SetAudiences(this ClaimsPrincipal principal, IEnumerable? audiences) - => principal.SetAudiences(audiences?.ToImmutableArray() ?? []); + => principal.SetAudiences(audiences?.ToImmutableArray() ?? ImmutableArray.Empty); /// /// Sets the audiences list in the claims identity. @@ -2888,7 +2888,7 @@ public static class OpenIddictExtensions /// The audiences to store. /// The claims identity. public static ClaimsIdentity SetAudiences(this ClaimsIdentity identity, params string[]? audiences) - => identity.SetAudiences(audiences?.ToImmutableArray() ?? []); + => identity.SetAudiences(audiences?.ToImmutableArray() ?? ImmutableArray.Empty); /// /// Sets the audiences list in the claims principal. @@ -2898,7 +2898,7 @@ public static class OpenIddictExtensions /// The audiences to store. /// The claims principal. public static ClaimsPrincipal SetAudiences(this ClaimsPrincipal principal, params string[]? audiences) - => principal.SetAudiences(audiences?.ToImmutableArray() ?? []); + => principal.SetAudiences(audiences?.ToImmutableArray() ?? ImmutableArray.Empty); /// /// Sets the presenters list in the claims identity. @@ -2928,7 +2928,7 @@ public static class OpenIddictExtensions /// The presenters to store. /// The claims identity. public static ClaimsIdentity SetPresenters(this ClaimsIdentity identity, IEnumerable? presenters) - => identity.SetPresenters(presenters?.ToImmutableArray() ?? []); + => identity.SetPresenters(presenters?.ToImmutableArray() ?? ImmutableArray.Empty); /// /// Sets the presenters list in the claims principal. @@ -2938,7 +2938,7 @@ public static class OpenIddictExtensions /// The presenters to store. /// The claims principal. public static ClaimsPrincipal SetPresenters(this ClaimsPrincipal principal, IEnumerable? presenters) - => principal.SetPresenters(presenters?.ToImmutableArray() ?? []); + => principal.SetPresenters(presenters?.ToImmutableArray() ?? ImmutableArray.Empty); /// /// Sets the presenters list in the claims identity. @@ -2948,7 +2948,7 @@ public static class OpenIddictExtensions /// The presenters to store. /// The claims identity. public static ClaimsIdentity SetPresenters(this ClaimsIdentity identity, params string[]? presenters) - => identity.SetPresenters(presenters?.ToImmutableArray() ?? []); + => identity.SetPresenters(presenters?.ToImmutableArray() ?? ImmutableArray.Empty); /// /// Sets the presenters list in the claims principal. @@ -2958,7 +2958,7 @@ public static class OpenIddictExtensions /// The presenters to store. /// The claims principal. public static ClaimsPrincipal SetPresenters(this ClaimsPrincipal principal, params string[]? presenters) - => principal.SetPresenters(presenters?.ToImmutableArray() ?? []); + => principal.SetPresenters(presenters?.ToImmutableArray() ?? ImmutableArray.Empty); /// /// Sets the resources list in the claims identity. @@ -2988,7 +2988,7 @@ public static class OpenIddictExtensions /// The resources to store. /// The claims identity. public static ClaimsIdentity SetResources(this ClaimsIdentity identity, IEnumerable? resources) - => identity.SetResources(resources?.ToImmutableArray() ?? []); + => identity.SetResources(resources?.ToImmutableArray() ?? ImmutableArray.Empty); /// /// Sets the resources list in the claims principal. @@ -2998,7 +2998,7 @@ public static class OpenIddictExtensions /// The resources to store. /// The claims principal. public static ClaimsPrincipal SetResources(this ClaimsPrincipal principal, IEnumerable? resources) - => principal.SetResources(resources?.ToImmutableArray() ?? []); + => principal.SetResources(resources?.ToImmutableArray() ?? ImmutableArray.Empty); /// /// Sets the resources list in the claims identity. @@ -3008,7 +3008,7 @@ public static class OpenIddictExtensions /// The resources to store. /// The claims identity. public static ClaimsIdentity SetResources(this ClaimsIdentity identity, params string[]? resources) - => identity.SetResources(resources?.ToImmutableArray() ?? []); + => identity.SetResources(resources?.ToImmutableArray() ?? ImmutableArray.Empty); /// /// Sets the resources list in the claims principal. @@ -3018,7 +3018,7 @@ public static class OpenIddictExtensions /// The resources to store. /// The claims principal. public static ClaimsPrincipal SetResources(this ClaimsPrincipal principal, params string[]? resources) - => principal.SetResources(resources?.ToImmutableArray() ?? []); + => principal.SetResources(resources?.ToImmutableArray() ?? ImmutableArray.Empty); /// /// Sets the scopes list in the claims identity. @@ -3048,7 +3048,7 @@ public static class OpenIddictExtensions /// The scopes to store. /// The claims identity. public static ClaimsIdentity SetScopes(this ClaimsIdentity identity, IEnumerable? scopes) - => identity.SetScopes(scopes?.ToImmutableArray() ?? []); + => identity.SetScopes(scopes?.ToImmutableArray() ?? ImmutableArray.Empty); /// /// Sets the scopes list in the claims principal. @@ -3058,7 +3058,7 @@ public static class OpenIddictExtensions /// The scopes to store. /// The claims principal. public static ClaimsPrincipal SetScopes(this ClaimsPrincipal principal, IEnumerable? scopes) - => principal.SetScopes(scopes?.ToImmutableArray() ?? []); + => principal.SetScopes(scopes?.ToImmutableArray() ?? ImmutableArray.Empty); /// /// Sets the scopes list in the claims identity. @@ -3068,7 +3068,7 @@ public static class OpenIddictExtensions /// The scopes to store. /// The claims identity. public static ClaimsIdentity SetScopes(this ClaimsIdentity identity, params string[]? scopes) - => identity.SetScopes(scopes?.ToImmutableArray() ?? []); + => identity.SetScopes(scopes?.ToImmutableArray() ?? ImmutableArray.Empty); /// /// Sets the scopes list in the claims principal. @@ -3078,7 +3078,7 @@ public static class OpenIddictExtensions /// The scopes to store. /// The claims principal. public static ClaimsPrincipal SetScopes(this ClaimsPrincipal principal, params string[]? scopes) - => principal.SetScopes(scopes?.ToImmutableArray() ?? []); + => principal.SetScopes(scopes?.ToImmutableArray() ?? ImmutableArray.Empty); /// /// Sets the access token lifetime associated with the claims identity. @@ -3266,7 +3266,7 @@ public static class OpenIddictExtensions if (string.IsNullOrEmpty(source)) { - return []; + return ImmutableArray.Empty; } var builder = ImmutableArray.CreateBuilder(); diff --git a/src/OpenIddict.Client.AspNetCore/OpenIddictClientAspNetCoreHandlers.Authentication.cs b/src/OpenIddict.Client.AspNetCore/OpenIddictClientAspNetCoreHandlers.Authentication.cs index b8637fd7..b407d2fd 100644 --- a/src/OpenIddict.Client.AspNetCore/OpenIddictClientAspNetCoreHandlers.Authentication.cs +++ b/src/OpenIddict.Client.AspNetCore/OpenIddictClientAspNetCoreHandlers.Authentication.cs @@ -14,7 +14,7 @@ public static partial class OpenIddictClientAspNetCoreHandlers { public static class Authentication { - public static ImmutableArray DefaultHandlers { get; } = [ + public static ImmutableArray DefaultHandlers { get; } = ImmutableArray.Create([ /* * Authorization request processing: */ @@ -38,7 +38,7 @@ public static partial class OpenIddictClientAspNetCoreHandlers ProcessPassthroughErrorResponse.Descriptor, ProcessStatusCodePagesErrorResponse.Descriptor, ProcessLocalErrorResponse.Descriptor - ]; + ]); /// /// Contains the logic responsible for processing authorization requests using 302 redirects. diff --git a/src/OpenIddict.Client.AspNetCore/OpenIddictClientAspNetCoreHandlers.Session.cs b/src/OpenIddict.Client.AspNetCore/OpenIddictClientAspNetCoreHandlers.Session.cs index 2248000f..a91a9713 100644 --- a/src/OpenIddict.Client.AspNetCore/OpenIddictClientAspNetCoreHandlers.Session.cs +++ b/src/OpenIddict.Client.AspNetCore/OpenIddictClientAspNetCoreHandlers.Session.cs @@ -14,7 +14,7 @@ public static partial class OpenIddictClientAspNetCoreHandlers { public static class Session { - public static ImmutableArray DefaultHandlers { get; } = [ + public static ImmutableArray DefaultHandlers { get; } = ImmutableArray.Create([ /* * Session request processing: */ @@ -38,7 +38,7 @@ public static partial class OpenIddictClientAspNetCoreHandlers ProcessPassthroughErrorResponse.Descriptor, ProcessStatusCodePagesErrorResponse.Descriptor, ProcessLocalErrorResponse.Descriptor - ]; + ]); /// /// Contains the logic responsible for processing authorization requests using 302 redirects. diff --git a/src/OpenIddict.Client.AspNetCore/OpenIddictClientAspNetCoreHandlers.cs b/src/OpenIddict.Client.AspNetCore/OpenIddictClientAspNetCoreHandlers.cs index 709d96b5..a020baaa 100644 --- a/src/OpenIddict.Client.AspNetCore/OpenIddictClientAspNetCoreHandlers.cs +++ b/src/OpenIddict.Client.AspNetCore/OpenIddictClientAspNetCoreHandlers.cs @@ -30,7 +30,7 @@ namespace OpenIddict.Client.AspNetCore; [EditorBrowsable(EditorBrowsableState.Never)] public static partial class OpenIddictClientAspNetCoreHandlers { - public static ImmutableArray DefaultHandlers { get; } = [ + public static ImmutableArray DefaultHandlers { get; } = ImmutableArray.Create([ /* * Top-level request processing: */ @@ -74,7 +74,7 @@ public static partial class OpenIddictClientAspNetCoreHandlers .. Authentication.DefaultHandlers, .. Session.DefaultHandlers - ]; + ]); /// /// Contains the logic responsible for resolving the request URI from the ASP.NET Core environment. diff --git a/src/OpenIddict.Client.DataProtection/OpenIddictClientDataProtectionHandlers.Protection.cs b/src/OpenIddict.Client.DataProtection/OpenIddictClientDataProtectionHandlers.Protection.cs index 9768ce20..d2600e04 100644 --- a/src/OpenIddict.Client.DataProtection/OpenIddictClientDataProtectionHandlers.Protection.cs +++ b/src/OpenIddict.Client.DataProtection/OpenIddictClientDataProtectionHandlers.Protection.cs @@ -21,7 +21,7 @@ public static partial class OpenIddictClientDataProtectionHandlers { public static class Protection { - public static ImmutableArray DefaultHandlers { get; } = [ + public static ImmutableArray DefaultHandlers { get; } = ImmutableArray.Create([ /* * Token validation: */ @@ -32,7 +32,7 @@ public static partial class OpenIddictClientDataProtectionHandlers */ OverrideGeneratedTokenFormat.Descriptor, GenerateDataProtectionToken.Descriptor - ]; + ]); /// /// Contains the logic responsible for validating tokens generated using Data Protection. diff --git a/src/OpenIddict.Client.DataProtection/OpenIddictClientDataProtectionHandlers.cs b/src/OpenIddict.Client.DataProtection/OpenIddictClientDataProtectionHandlers.cs index d66d7fd8..608da23f 100644 --- a/src/OpenIddict.Client.DataProtection/OpenIddictClientDataProtectionHandlers.cs +++ b/src/OpenIddict.Client.DataProtection/OpenIddictClientDataProtectionHandlers.cs @@ -13,5 +13,5 @@ namespace OpenIddict.Client.DataProtection; public static partial class OpenIddictClientDataProtectionHandlers { public static ImmutableArray DefaultHandlers { get; } - = [.. Protection.DefaultHandlers]; + = ImmutableArray.Create([.. Protection.DefaultHandlers]); } diff --git a/src/OpenIddict.Client.Owin/OpenIddictClientOwinHandlers.Authentication.cs b/src/OpenIddict.Client.Owin/OpenIddictClientOwinHandlers.Authentication.cs index fadfc77c..b4383490 100644 --- a/src/OpenIddict.Client.Owin/OpenIddictClientOwinHandlers.Authentication.cs +++ b/src/OpenIddict.Client.Owin/OpenIddictClientOwinHandlers.Authentication.cs @@ -13,7 +13,7 @@ public static partial class OpenIddictClientOwinHandlers { public static class Authentication { - public static ImmutableArray DefaultHandlers { get; } = [ + public static ImmutableArray DefaultHandlers { get; } = ImmutableArray.Create([ /* * Authorization request processing: */ @@ -38,7 +38,7 @@ public static partial class OpenIddictClientOwinHandlers AttachCacheControlHeader.Descriptor, ProcessPassthroughErrorResponse.Descriptor, ProcessLocalErrorResponse.Descriptor - ]; + ]); /// /// Contains the logic responsible for processing authorization requests using 302 redirects. diff --git a/src/OpenIddict.Client.Owin/OpenIddictClientOwinHandlers.Session.cs b/src/OpenIddict.Client.Owin/OpenIddictClientOwinHandlers.Session.cs index 8274e989..67192920 100644 --- a/src/OpenIddict.Client.Owin/OpenIddictClientOwinHandlers.Session.cs +++ b/src/OpenIddict.Client.Owin/OpenIddictClientOwinHandlers.Session.cs @@ -13,7 +13,7 @@ public static partial class OpenIddictClientOwinHandlers { public static class Session { - public static ImmutableArray DefaultHandlers { get; } = [ + public static ImmutableArray DefaultHandlers { get; } = ImmutableArray.Create([ /* * Session request processing: */ @@ -36,7 +36,7 @@ public static partial class OpenIddictClientOwinHandlers AttachCacheControlHeader.Descriptor, ProcessPassthroughErrorResponse.Descriptor, ProcessLocalErrorResponse.Descriptor - ]; + ]); /// /// Contains the logic responsible for processing authorization requests using 302 redirects. diff --git a/src/OpenIddict.Client.Owin/OpenIddictClientOwinHandlers.cs b/src/OpenIddict.Client.Owin/OpenIddictClientOwinHandlers.cs index 7f73bf24..11ac62b4 100644 --- a/src/OpenIddict.Client.Owin/OpenIddictClientOwinHandlers.cs +++ b/src/OpenIddict.Client.Owin/OpenIddictClientOwinHandlers.cs @@ -25,7 +25,7 @@ namespace OpenIddict.Client.Owin; [EditorBrowsable(EditorBrowsableState.Never)] public static partial class OpenIddictClientOwinHandlers { - public static ImmutableArray DefaultHandlers { get; } = [ + public static ImmutableArray DefaultHandlers { get; } = ImmutableArray.Create([ /* * Top-level request processing: */ @@ -68,7 +68,7 @@ public static partial class OpenIddictClientOwinHandlers .. Authentication.DefaultHandlers, .. Session.DefaultHandlers - ]; + ]); /// /// Contains the logic responsible for resolving the request URI from the OWIN environment. diff --git a/src/OpenIddict.Client.SystemIntegration/OpenIddictClientSystemIntegrationHandlers.Authentication.cs b/src/OpenIddict.Client.SystemIntegration/OpenIddictClientSystemIntegrationHandlers.Authentication.cs index 9a0be002..21612bd2 100644 --- a/src/OpenIddict.Client.SystemIntegration/OpenIddictClientSystemIntegrationHandlers.Authentication.cs +++ b/src/OpenIddict.Client.SystemIntegration/OpenIddictClientSystemIntegrationHandlers.Authentication.cs @@ -23,7 +23,7 @@ public static partial class OpenIddictClientSystemIntegrationHandlers { public static class Authentication { - public static ImmutableArray DefaultHandlers { get; } = [ + public static ImmutableArray DefaultHandlers { get; } = ImmutableArray.Create([ /* * Authorization request processing: */ @@ -45,7 +45,7 @@ public static partial class OpenIddictClientSystemIntegrationHandlers ProcessEmptyHttpResponse.Descriptor, ProcessProtocolActivationResponse.Descriptor, ProcessWebAuthenticationResultResponse.Descriptor - ]; + ]); /// /// Contains the logic responsible for initiating authorization requests using the web authentication broker. diff --git a/src/OpenIddict.Client.SystemIntegration/OpenIddictClientSystemIntegrationHandlers.cs b/src/OpenIddict.Client.SystemIntegration/OpenIddictClientSystemIntegrationHandlers.cs index e72436ec..2f96061d 100644 --- a/src/OpenIddict.Client.SystemIntegration/OpenIddictClientSystemIntegrationHandlers.cs +++ b/src/OpenIddict.Client.SystemIntegration/OpenIddictClientSystemIntegrationHandlers.cs @@ -31,7 +31,7 @@ namespace OpenIddict.Client.SystemIntegration; [EditorBrowsable(EditorBrowsableState.Never)] public static partial class OpenIddictClientSystemIntegrationHandlers { - public static ImmutableArray DefaultHandlers { get; } = [ + public static ImmutableArray DefaultHandlers { get; } = ImmutableArray.Create([ /* * Top-level request processing: */ @@ -83,7 +83,7 @@ public static partial class OpenIddictClientSystemIntegrationHandlers AbortAuthenticationDemand.Descriptor, .. Authentication.DefaultHandlers - ]; + ]); /// /// Contains the logic responsible for resolving the request URI from the HTTP listener request. diff --git a/src/OpenIddict.Client.SystemNetHttp/OpenIddictClientSystemNetHttpHandlers.Device.cs b/src/OpenIddict.Client.SystemNetHttp/OpenIddictClientSystemNetHttpHandlers.Device.cs index 87b3f56f..5e84a711 100644 --- a/src/OpenIddict.Client.SystemNetHttp/OpenIddictClientSystemNetHttpHandlers.Device.cs +++ b/src/OpenIddict.Client.SystemNetHttp/OpenIddictClientSystemNetHttpHandlers.Device.cs @@ -16,7 +16,7 @@ public static partial class OpenIddictClientSystemNetHttpHandlers { public static class Device { - public static ImmutableArray DefaultHandlers { get; } = [ + public static ImmutableArray DefaultHandlers { get; } = ImmutableArray.Create([ /* * DeviceAuthorization request processing: */ @@ -39,7 +39,7 @@ public static partial class OpenIddictClientSystemNetHttpHandlers ExtractWwwAuthenticateHeader.Descriptor, ValidateHttpResponse.Descriptor, DisposeHttpResponse.Descriptor - ]; + ]); /// /// Contains the logic responsible for attaching the client credentials to the HTTP Authorization header. diff --git a/src/OpenIddict.Client.SystemNetHttp/OpenIddictClientSystemNetHttpHandlers.Discovery.cs b/src/OpenIddict.Client.SystemNetHttp/OpenIddictClientSystemNetHttpHandlers.Discovery.cs index 8fa41c9b..b301d43f 100644 --- a/src/OpenIddict.Client.SystemNetHttp/OpenIddictClientSystemNetHttpHandlers.Discovery.cs +++ b/src/OpenIddict.Client.SystemNetHttp/OpenIddictClientSystemNetHttpHandlers.Discovery.cs @@ -12,7 +12,7 @@ public static partial class OpenIddictClientSystemNetHttpHandlers { public static class Discovery { - public static ImmutableArray DefaultHandlers { get; } = [ + public static ImmutableArray DefaultHandlers { get; } = ImmutableArray.Create([ /* * Configuration request processing: */ @@ -56,6 +56,6 @@ public static partial class OpenIddictClientSystemNetHttpHandlers ExtractWwwAuthenticateHeader.Descriptor, ValidateHttpResponse.Descriptor, DisposeHttpResponse.Descriptor - ]; + ]); } } diff --git a/src/OpenIddict.Client.SystemNetHttp/OpenIddictClientSystemNetHttpHandlers.Exchange.cs b/src/OpenIddict.Client.SystemNetHttp/OpenIddictClientSystemNetHttpHandlers.Exchange.cs index 951e2c4a..1c3465d0 100644 --- a/src/OpenIddict.Client.SystemNetHttp/OpenIddictClientSystemNetHttpHandlers.Exchange.cs +++ b/src/OpenIddict.Client.SystemNetHttp/OpenIddictClientSystemNetHttpHandlers.Exchange.cs @@ -16,7 +16,7 @@ public static partial class OpenIddictClientSystemNetHttpHandlers { public static class Exchange { - public static ImmutableArray DefaultHandlers { get; } = [ + public static ImmutableArray DefaultHandlers { get; } = ImmutableArray.Create([ /* * Token request processing: */ @@ -39,7 +39,7 @@ public static partial class OpenIddictClientSystemNetHttpHandlers ExtractWwwAuthenticateHeader.Descriptor, ValidateHttpResponse.Descriptor, DisposeHttpResponse.Descriptor - ]; + ]); /// /// Contains the logic responsible for attaching the client credentials to the HTTP Authorization header. diff --git a/src/OpenIddict.Client.SystemNetHttp/OpenIddictClientSystemNetHttpHandlers.Introspection.cs b/src/OpenIddict.Client.SystemNetHttp/OpenIddictClientSystemNetHttpHandlers.Introspection.cs index 3d73c758..34e8fd74 100644 --- a/src/OpenIddict.Client.SystemNetHttp/OpenIddictClientSystemNetHttpHandlers.Introspection.cs +++ b/src/OpenIddict.Client.SystemNetHttp/OpenIddictClientSystemNetHttpHandlers.Introspection.cs @@ -16,7 +16,7 @@ public static partial class OpenIddictClientSystemNetHttpHandlers { public static class Introspection { - public static ImmutableArray DefaultHandlers { get; } = [ + public static ImmutableArray DefaultHandlers { get; } = ImmutableArray.Create([ /* * Introspection request processing: */ @@ -39,7 +39,7 @@ public static partial class OpenIddictClientSystemNetHttpHandlers ExtractWwwAuthenticateHeader.Descriptor, ValidateHttpResponse.Descriptor, DisposeHttpResponse.Descriptor - ]; + ]); /// /// Contains the logic responsible for attaching the client credentials to the HTTP Authorization header. diff --git a/src/OpenIddict.Client.SystemNetHttp/OpenIddictClientSystemNetHttpHandlers.Revocation.cs b/src/OpenIddict.Client.SystemNetHttp/OpenIddictClientSystemNetHttpHandlers.Revocation.cs index 41d336f8..977c9c08 100644 --- a/src/OpenIddict.Client.SystemNetHttp/OpenIddictClientSystemNetHttpHandlers.Revocation.cs +++ b/src/OpenIddict.Client.SystemNetHttp/OpenIddictClientSystemNetHttpHandlers.Revocation.cs @@ -16,7 +16,7 @@ public static partial class OpenIddictClientSystemNetHttpHandlers { public static class Revocation { - public static ImmutableArray DefaultHandlers { get; } = [ + public static ImmutableArray DefaultHandlers { get; } = ImmutableArray.Create([ /* * Revocation request processing: */ @@ -40,7 +40,7 @@ public static partial class OpenIddictClientSystemNetHttpHandlers ExtractEmptyHttpResponse.Descriptor, ValidateHttpResponse.Descriptor, DisposeHttpResponse.Descriptor - ]; + ]); /// /// Contains the logic responsible for attaching the client credentials to the HTTP Authorization header. diff --git a/src/OpenIddict.Client.SystemNetHttp/OpenIddictClientSystemNetHttpHandlers.Userinfo.cs b/src/OpenIddict.Client.SystemNetHttp/OpenIddictClientSystemNetHttpHandlers.Userinfo.cs index 7c0b1fb3..86ca4ac6 100644 --- a/src/OpenIddict.Client.SystemNetHttp/OpenIddictClientSystemNetHttpHandlers.Userinfo.cs +++ b/src/OpenIddict.Client.SystemNetHttp/OpenIddictClientSystemNetHttpHandlers.Userinfo.cs @@ -16,7 +16,7 @@ public static partial class OpenIddictClientSystemNetHttpHandlers { public static class Userinfo { - public static ImmutableArray DefaultHandlers { get; } = [ + public static ImmutableArray DefaultHandlers { get; } = ImmutableArray.Create([ /* * Userinfo request processing: */ @@ -40,7 +40,7 @@ public static partial class OpenIddictClientSystemNetHttpHandlers ExtractWwwAuthenticateHeader.Descriptor, ValidateHttpResponse.Descriptor, DisposeHttpResponse.Descriptor - ]; + ]); /// /// Contains the logic responsible for attaching the access token to the HTTP Authorization header. diff --git a/src/OpenIddict.Client.SystemNetHttp/OpenIddictClientSystemNetHttpHandlers.cs b/src/OpenIddict.Client.SystemNetHttp/OpenIddictClientSystemNetHttpHandlers.cs index 9082cbdf..a41f22b8 100644 --- a/src/OpenIddict.Client.SystemNetHttp/OpenIddictClientSystemNetHttpHandlers.cs +++ b/src/OpenIddict.Client.SystemNetHttp/OpenIddictClientSystemNetHttpHandlers.cs @@ -21,14 +21,14 @@ namespace OpenIddict.Client.SystemNetHttp; [EditorBrowsable(EditorBrowsableState.Never)] public static partial class OpenIddictClientSystemNetHttpHandlers { - public static ImmutableArray DefaultHandlers { get; } = [ + public static ImmutableArray DefaultHandlers { get; } = ImmutableArray.Create([ .. Device.DefaultHandlers, .. Discovery.DefaultHandlers, .. Exchange.DefaultHandlers, .. Introspection.DefaultHandlers, .. Revocation.DefaultHandlers, .. Userinfo.DefaultHandlers - ]; + ]); /// /// Contains the logic responsible for creating and attaching a . diff --git a/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.Authentication.cs b/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.Authentication.cs index a24d8b6c..624c831c 100644 --- a/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.Authentication.cs +++ b/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.Authentication.cs @@ -13,12 +13,12 @@ public static partial class OpenIddictClientWebIntegrationHandlers { public static class Authentication { - public static ImmutableArray DefaultHandlers { get; } = [ + public static ImmutableArray DefaultHandlers { get; } = ImmutableArray.Create([ /* * Authorization request preparation: */ MapNonStandardRequestParameters.Descriptor - ]; + ]); /// /// Contains the logic responsible for mapping non-standard request parameters diff --git a/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.Device.cs b/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.Device.cs index 876415a7..3ceef3cc 100644 --- a/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.Device.cs +++ b/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.Device.cs @@ -13,12 +13,12 @@ public static partial class OpenIddictClientWebIntegrationHandlers { public static class Device { - public static ImmutableArray DefaultHandlers { get; } = [ + public static ImmutableArray DefaultHandlers { get; } = ImmutableArray.Create([ /* * Token response extraction: */ MapNonStandardResponseParameters.Descriptor - ]; + ]); /// /// Contains the logic responsible for mapping non-standard response parameters diff --git a/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.Discovery.cs b/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.Discovery.cs index e1f67e3c..6a9d37b7 100644 --- a/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.Discovery.cs +++ b/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.Discovery.cs @@ -15,7 +15,7 @@ public static partial class OpenIddictClientWebIntegrationHandlers { public static class Discovery { - public static ImmutableArray DefaultHandlers { get; } = [ + public static ImmutableArray DefaultHandlers { get; } = ImmutableArray.Create([ /* * Configuration response handling: */ @@ -25,7 +25,7 @@ public static partial class OpenIddictClientWebIntegrationHandlers AmendScopes.Descriptor, AmendClientAuthenticationMethods.Descriptor, AmendEndpoints.Descriptor - ]; + ]); /// /// Contains the logic responsible for amending the issuer for the providers that require it. diff --git a/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.Exchange.cs b/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.Exchange.cs index 3ab7a2e0..81dbcc9f 100644 --- a/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.Exchange.cs +++ b/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.Exchange.cs @@ -24,7 +24,7 @@ public static partial class OpenIddictClientWebIntegrationHandlers { public static class Exchange { - public static ImmutableArray DefaultHandlers { get; } = [ + public static ImmutableArray DefaultHandlers { get; } = ImmutableArray.Create([ /* * Token request preparation: */ @@ -38,7 +38,7 @@ public static partial class OpenIddictClientWebIntegrationHandlers * Token response extraction: */ MapNonStandardResponseParameters.Descriptor - ]; + ]); /// /// Contains the logic responsible for mapping non-standard request parameters diff --git a/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.Protection.cs b/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.Protection.cs index c34468bb..95f5f51a 100644 --- a/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.Protection.cs +++ b/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.Protection.cs @@ -14,12 +14,12 @@ public static partial class OpenIddictClientWebIntegrationHandlers { public static class Protection { - public static ImmutableArray DefaultHandlers { get; } = [ + public static ImmutableArray DefaultHandlers { get; } = ImmutableArray.Create([ /* * Token validation: */ AmendTokenValidationParameters.Descriptor - ]; + ]); /// /// Contains the logic responsible for amending the token validation parameters for the providers that require it. diff --git a/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.Revocation.cs b/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.Revocation.cs index f02e80b8..e0dce7af 100644 --- a/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.Revocation.cs +++ b/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.Revocation.cs @@ -20,7 +20,7 @@ public static partial class OpenIddictClientWebIntegrationHandlers { public static class Revocation { - public static ImmutableArray DefaultHandlers { get; } = [ + public static ImmutableArray DefaultHandlers { get; } = ImmutableArray.Create([ /* * Revocation request preparation: */ @@ -30,7 +30,7 @@ public static partial class OpenIddictClientWebIntegrationHandlers * Revocation response extraction: */ NormalizeContentType.Descriptor - ]; + ]); /// /// Contains the logic responsible for attaching the client credentials to the HTTP Authorization diff --git a/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.Userinfo.cs b/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.Userinfo.cs index 0850e7b3..82403717 100644 --- a/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.Userinfo.cs +++ b/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.Userinfo.cs @@ -21,7 +21,7 @@ public static partial class OpenIddictClientWebIntegrationHandlers { public static class Userinfo { - public static ImmutableArray DefaultHandlers { get; } = [ + public static ImmutableArray DefaultHandlers { get; } = ImmutableArray.Create([ /* * Userinfo request preparation: */ @@ -36,7 +36,7 @@ public static partial class OpenIddictClientWebIntegrationHandlers */ NormalizeContentType.Descriptor, UnwrapUserinfoResponse.Descriptor - ]; + ]); /// /// Contains the logic responsible for overriding the HTTP method for the providers that require it. diff --git a/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.cs b/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.cs index ce88ef40..2fe301ff 100644 --- a/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.cs +++ b/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.cs @@ -18,7 +18,7 @@ namespace OpenIddict.Client.WebIntegration; [EditorBrowsable(EditorBrowsableState.Never)] public static partial class OpenIddictClientWebIntegrationHandlers { - public static ImmutableArray DefaultHandlers { get; } = [ + public static ImmutableArray DefaultHandlers { get; } = ImmutableArray.Create([ /* * Authentication processing: */ @@ -62,7 +62,7 @@ public static partial class OpenIddictClientWebIntegrationHandlers .. Protection.DefaultHandlers, .. Revocation.DefaultHandlers, .. Userinfo.DefaultHandlers - ]; + ]); /// /// Contains the logic responsible for validating the signature or message authentication diff --git a/src/OpenIddict.Client/OpenIddictClientHandlerDescriptor.cs b/src/OpenIddict.Client/OpenIddictClientHandlerDescriptor.cs index 665ba4e3..fff7022a 100644 --- a/src/OpenIddict.Client/OpenIddictClientHandlerDescriptor.cs +++ b/src/OpenIddict.Client/OpenIddictClientHandlerDescriptor.cs @@ -31,7 +31,7 @@ public sealed class OpenIddictClientHandlerDescriptor /// Gets the list of filters responsible for excluding the handler /// from the activated handlers if it doesn't meet the criteria. /// - public ImmutableArray FilterTypes { get; private set; } = []; + public ImmutableArray FilterTypes { get; private set; } = ImmutableArray.Empty; /// /// Gets the order assigned to the handler. diff --git a/src/OpenIddict.Client/OpenIddictClientHandlers.Authentication.cs b/src/OpenIddict.Client/OpenIddictClientHandlers.Authentication.cs index 10f99fd7..5ff0cae4 100644 --- a/src/OpenIddict.Client/OpenIddictClientHandlers.Authentication.cs +++ b/src/OpenIddict.Client/OpenIddictClientHandlers.Authentication.cs @@ -13,7 +13,7 @@ public static partial class OpenIddictClientHandlers { public static class Authentication { - public static ImmutableArray DefaultHandlers { get; } = [ + public static ImmutableArray DefaultHandlers { get; } = ImmutableArray.Create([ /* * Authorization request top-level processing: */ @@ -43,7 +43,7 @@ public static partial class OpenIddictClientHandlers * Redirection request validation: */ ValidateTokens.Descriptor - ]; + ]); /// /// Contains the logic responsible for preparing authorization requests and invoking the corresponding event handlers. diff --git a/src/OpenIddict.Client/OpenIddictClientHandlers.Device.cs b/src/OpenIddict.Client/OpenIddictClientHandlers.Device.cs index 96a3cce8..8087f988 100644 --- a/src/OpenIddict.Client/OpenIddictClientHandlers.Device.cs +++ b/src/OpenIddict.Client/OpenIddictClientHandlers.Device.cs @@ -14,14 +14,14 @@ public static partial class OpenIddictClientHandlers { public static class Device { - public static ImmutableArray DefaultHandlers { get; } = [ + public static ImmutableArray DefaultHandlers { get; } = ImmutableArray.Create([ /* * Device authorization response handling: */ ValidateWellKnownParameters.Descriptor, HandleErrorResponse.Descriptor, ValidateVerificationEndpointUri.Descriptor - ]; + ]); /// /// Contains the logic responsible for validating the well-known parameters contained in the device authorization response. diff --git a/src/OpenIddict.Client/OpenIddictClientHandlers.Discovery.cs b/src/OpenIddict.Client/OpenIddictClientHandlers.Discovery.cs index 1148ab2c..874de433 100644 --- a/src/OpenIddict.Client/OpenIddictClientHandlers.Discovery.cs +++ b/src/OpenIddict.Client/OpenIddictClientHandlers.Discovery.cs @@ -15,7 +15,7 @@ public static partial class OpenIddictClientHandlers { public static class Discovery { - public static ImmutableArray DefaultHandlers { get; } = [ + public static ImmutableArray DefaultHandlers { get; } = ImmutableArray.Create([ /* * Configuration response handling: */ @@ -47,7 +47,7 @@ public static partial class OpenIddictClientHandlers ValidateWellKnownCryptographyParameters.Descriptor, HandleCryptographyErrorResponse.Descriptor, ExtractSigningKeys.Descriptor - ]; + ]); /// /// Contains the logic responsible for validating the well-known parameters contained in the configuration response. diff --git a/src/OpenIddict.Client/OpenIddictClientHandlers.Exchange.cs b/src/OpenIddict.Client/OpenIddictClientHandlers.Exchange.cs index e0f49dd8..aee20ab4 100644 --- a/src/OpenIddict.Client/OpenIddictClientHandlers.Exchange.cs +++ b/src/OpenIddict.Client/OpenIddictClientHandlers.Exchange.cs @@ -14,13 +14,13 @@ public static partial class OpenIddictClientHandlers { public static class Exchange { - public static ImmutableArray DefaultHandlers { get; } = [ + public static ImmutableArray DefaultHandlers { get; } = ImmutableArray.Create([ /* * Token response handling: */ ValidateWellKnownParameters.Descriptor, HandleErrorResponse.Descriptor - ]; + ]); /// /// Contains the logic responsible for validating the well-known parameters contained in the token response. diff --git a/src/OpenIddict.Client/OpenIddictClientHandlers.Introspection.cs b/src/OpenIddict.Client/OpenIddictClientHandlers.Introspection.cs index f3711c8d..7030313f 100644 --- a/src/OpenIddict.Client/OpenIddictClientHandlers.Introspection.cs +++ b/src/OpenIddict.Client/OpenIddictClientHandlers.Introspection.cs @@ -17,7 +17,7 @@ public static partial class OpenIddictClientHandlers { public static class Introspection { - public static ImmutableArray DefaultHandlers { get; } = [ + public static ImmutableArray DefaultHandlers { get; } = ImmutableArray.Create([ /* * Introspection response handling: */ @@ -29,7 +29,7 @@ public static partial class OpenIddictClientHandlers ValidateTokenUsage.Descriptor, PopulateClaims.Descriptor, MapInternalClaims.Descriptor - ]; + ]); /// /// Contains the logic responsible for validating the well-known parameters contained in the introspection response. @@ -513,7 +513,7 @@ public static partial class OpenIddictClientHandlers string identifier when !string.IsNullOrEmpty(identifier) => ImmutableArray.Create(identifier), - _ => [] + _ => ImmutableArray.Empty }); // Map the internal "oi_scp" claims from the standard, space-separated "scope" claim, if available. @@ -521,7 +521,7 @@ public static partial class OpenIddictClientHandlers { string scope => scope.Split(Separators.Space, StringSplitOptions.RemoveEmptyEntries).ToImmutableArray(), - _ => [] + _ => ImmutableArray.Empty }); return default; diff --git a/src/OpenIddict.Client/OpenIddictClientHandlers.Protection.cs b/src/OpenIddict.Client/OpenIddictClientHandlers.Protection.cs index 17b39ad3..51c69d2a 100644 --- a/src/OpenIddict.Client/OpenIddictClientHandlers.Protection.cs +++ b/src/OpenIddict.Client/OpenIddictClientHandlers.Protection.cs @@ -19,7 +19,7 @@ public static partial class OpenIddictClientHandlers { public static class Protection { - public static ImmutableArray DefaultHandlers { get; } = [ + public static ImmutableArray DefaultHandlers { get; } = ImmutableArray.Create([ /* * Token validation: */ @@ -39,7 +39,7 @@ public static partial class OpenIddictClientHandlers CreateTokenEntry.Descriptor, GenerateIdentityModelToken.Descriptor, AttachTokenPayload.Descriptor - ]; + ]); /// /// Contains the logic responsible for resolving the validation parameters used to validate tokens. diff --git a/src/OpenIddict.Client/OpenIddictClientHandlers.Revocation.cs b/src/OpenIddict.Client/OpenIddictClientHandlers.Revocation.cs index 20f5521e..05dcbf05 100644 --- a/src/OpenIddict.Client/OpenIddictClientHandlers.Revocation.cs +++ b/src/OpenIddict.Client/OpenIddictClientHandlers.Revocation.cs @@ -14,13 +14,13 @@ public static partial class OpenIddictClientHandlers { public static class Revocation { - public static ImmutableArray DefaultHandlers { get; } = [ + public static ImmutableArray DefaultHandlers { get; } = ImmutableArray.Create([ /* * Revocation response handling: */ ValidateWellKnownParameters.Descriptor, HandleErrorResponse.Descriptor - ]; + ]); /// /// Contains the logic responsible for validating the well-known parameters contained in the revocation response. diff --git a/src/OpenIddict.Client/OpenIddictClientHandlers.Session.cs b/src/OpenIddict.Client/OpenIddictClientHandlers.Session.cs index 16190430..966a8508 100644 --- a/src/OpenIddict.Client/OpenIddictClientHandlers.Session.cs +++ b/src/OpenIddict.Client/OpenIddictClientHandlers.Session.cs @@ -13,7 +13,7 @@ public static partial class OpenIddictClientHandlers { public static class Session { - public static ImmutableArray DefaultHandlers { get; } = [ + public static ImmutableArray DefaultHandlers { get; } = ImmutableArray.Create([ /* * Logout request top-level processing: */ @@ -38,7 +38,7 @@ public static partial class OpenIddictClientHandlers * Post-logout redirection request validation: */ ValidateTokens.Descriptor - ]; + ]); /// /// Contains the logic responsible for preparing authorization requests and invoking the corresponding event handlers. diff --git a/src/OpenIddict.Client/OpenIddictClientHandlers.Userinfo.cs b/src/OpenIddict.Client/OpenIddictClientHandlers.Userinfo.cs index 53a1aa6a..db6e758f 100644 --- a/src/OpenIddict.Client/OpenIddictClientHandlers.Userinfo.cs +++ b/src/OpenIddict.Client/OpenIddictClientHandlers.Userinfo.cs @@ -16,14 +16,14 @@ public static partial class OpenIddictClientHandlers { public static class Userinfo { - public static ImmutableArray DefaultHandlers { get; } = [ + public static ImmutableArray DefaultHandlers { get; } = ImmutableArray.Create([ /* * Userinfo response handling: */ ValidateWellKnownParameters.Descriptor, HandleErrorResponse.Descriptor, PopulateClaims.Descriptor - ]; + ]); /// /// Contains the logic responsible for validating the well-known parameters contained in the userinfo response. diff --git a/src/OpenIddict.Client/OpenIddictClientHandlers.cs b/src/OpenIddict.Client/OpenIddictClientHandlers.cs index 327944d2..b35d3b6d 100644 --- a/src/OpenIddict.Client/OpenIddictClientHandlers.cs +++ b/src/OpenIddict.Client/OpenIddictClientHandlers.cs @@ -22,7 +22,7 @@ namespace OpenIddict.Client; [EditorBrowsable(EditorBrowsableState.Never)] public static partial class OpenIddictClientHandlers { - public static ImmutableArray DefaultHandlers { get; } = [ + public static ImmutableArray DefaultHandlers { get; } = ImmutableArray.Create([ /* * Top-level request processing: */ @@ -192,7 +192,7 @@ public static partial class OpenIddictClientHandlers .. Revocation.DefaultHandlers, .. Session.DefaultHandlers, .. Userinfo.DefaultHandlers - ]; + ]); /// /// Contains the logic responsible for inferring the endpoint type from the request URI. diff --git a/src/OpenIddict.Client/OpenIddictClientService.cs b/src/OpenIddict.Client/OpenIddictClientService.cs index 62400752..4eeee7d6 100644 --- a/src/OpenIddict.Client/OpenIddictClientService.cs +++ b/src/OpenIddict.Client/OpenIddictClientService.cs @@ -47,7 +47,7 @@ public class OpenIddictClientService var options = _provider.GetRequiredService>(); return new(options.CurrentValue.Registrations switch { - [ ] => ImmutableArray.Create(), + [ ] => ImmutableArray.Empty, [..] registrations => registrations.ToImmutableArray() }); } diff --git a/src/OpenIddict.Core/Managers/OpenIddictApplicationManager.cs b/src/OpenIddict.Core/Managers/OpenIddictApplicationManager.cs index 7b978913..9694727d 100644 --- a/src/OpenIddict.Core/Managers/OpenIddictApplicationManager.cs +++ b/src/OpenIddict.Core/Managers/OpenIddictApplicationManager.cs @@ -1025,9 +1025,11 @@ public class OpenIddictApplicationManager : IOpenIddictApplication await Store.SetDisplayNamesAsync(application, descriptor.DisplayNames.ToImmutableDictionary(), cancellationToken); await Store.SetJsonWebKeySetAsync(application, descriptor.JsonWebKeySet, cancellationToken); await Store.SetPermissionsAsync(application, descriptor.Permissions.ToImmutableArray(), cancellationToken); - await Store.SetPostLogoutRedirectUrisAsync(application, [.. descriptor.PostLogoutRedirectUris.Select(uri => uri.OriginalString)], cancellationToken); + await Store.SetPostLogoutRedirectUrisAsync(application, + descriptor.PostLogoutRedirectUris.Select(uri => uri.OriginalString).ToImmutableArray(), cancellationToken); await Store.SetPropertiesAsync(application, descriptor.Properties.ToImmutableDictionary(), cancellationToken); - await Store.SetRedirectUrisAsync(application, [.. descriptor.RedirectUris.Select(uri => uri.OriginalString)], cancellationToken); + await Store.SetRedirectUrisAsync(application, + descriptor.RedirectUris.Select(uri => uri.OriginalString).ToImmutableArray(), cancellationToken); await Store.SetRequirementsAsync(application, descriptor.Requirements.ToImmutableArray(), cancellationToken); await Store.SetSettingsAsync(application, descriptor.Settings.ToImmutableDictionary(), cancellationToken); } @@ -1322,9 +1324,9 @@ public class OpenIddictApplicationManager : IOpenIddictApplication // When callback URIs are specified, ensure they are valid and spec-compliant. // See https://tools.ietf.org/html/rfc6749#section-3.1 for more information. - foreach (var uri in ImmutableArray.Create() - .AddRange(await Store.GetPostLogoutRedirectUrisAsync(application, cancellationToken)) - .AddRange(await Store.GetRedirectUrisAsync(application, cancellationToken))) + foreach (var uri in (List) [ + .. await Store.GetPostLogoutRedirectUrisAsync(application, cancellationToken), + .. await Store.GetRedirectUrisAsync(application, cancellationToken)]) { // Ensure the URI is not null or empty. if (string.IsNullOrEmpty(uri)) diff --git a/src/OpenIddict.EntityFramework/Stores/OpenIddictEntityFrameworkApplicationStore.cs b/src/OpenIddict.EntityFramework/Stores/OpenIddictEntityFrameworkApplicationStore.cs index f33a741c..941d2b7d 100644 --- a/src/OpenIddict.EntityFramework/Stores/OpenIddictEntityFrameworkApplicationStore.cs +++ b/src/OpenIddict.EntityFramework/Stores/OpenIddictEntityFrameworkApplicationStore.cs @@ -489,7 +489,7 @@ public class OpenIddictEntityFrameworkApplicationStore.Empty); } // Note: parsing the stringified permissions is an expensive operation. @@ -530,7 +530,7 @@ public class OpenIddictEntityFrameworkApplicationStore.Empty); } // Note: parsing the stringified URIs is an expensive operation. @@ -606,7 +606,7 @@ public class OpenIddictEntityFrameworkApplicationStore.Empty); } // Note: parsing the stringified URIs is an expensive operation. @@ -647,7 +647,7 @@ public class OpenIddictEntityFrameworkApplicationStore.Empty); } // Note: parsing the stringified requirements is an expensive operation. diff --git a/src/OpenIddict.EntityFramework/Stores/OpenIddictEntityFrameworkAuthorizationStore.cs b/src/OpenIddict.EntityFramework/Stores/OpenIddictEntityFrameworkAuthorizationStore.cs index b92b1597..ab30ea1c 100644 --- a/src/OpenIddict.EntityFramework/Stores/OpenIddictEntityFrameworkAuthorizationStore.cs +++ b/src/OpenIddict.EntityFramework/Stores/OpenIddictEntityFrameworkAuthorizationStore.cs @@ -486,7 +486,7 @@ public class OpenIddictEntityFrameworkAuthorizationStore.Empty); } // Note: parsing the stringified scopes is an expensive operation. diff --git a/src/OpenIddict.EntityFramework/Stores/OpenIddictEntityFrameworkScopeStore.cs b/src/OpenIddict.EntityFramework/Stores/OpenIddictEntityFrameworkScopeStore.cs index dc1bcbc2..a81c2e3d 100644 --- a/src/OpenIddict.EntityFramework/Stores/OpenIddictEntityFrameworkScopeStore.cs +++ b/src/OpenIddict.EntityFramework/Stores/OpenIddictEntityFrameworkScopeStore.cs @@ -407,7 +407,7 @@ public class OpenIddictEntityFrameworkScopeStore : IOpen if (string.IsNullOrEmpty(scope.Resources)) { - return new([]); + return new(ImmutableArray.Empty); } // Note: parsing the stringified resources is an expensive operation. diff --git a/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictEntityFrameworkCoreApplicationStore.cs b/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictEntityFrameworkCoreApplicationStore.cs index 7ed453eb..756d4af1 100644 --- a/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictEntityFrameworkCoreApplicationStore.cs +++ b/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictEntityFrameworkCoreApplicationStore.cs @@ -558,7 +558,7 @@ public class OpenIddictEntityFrameworkCoreApplicationStore.Empty); } // Note: parsing the stringified permissions is an expensive operation. @@ -599,7 +599,7 @@ public class OpenIddictEntityFrameworkCoreApplicationStore.Empty); } // Note: parsing the stringified URIs is an expensive operation. @@ -675,7 +675,7 @@ public class OpenIddictEntityFrameworkCoreApplicationStore.Empty); } // Note: parsing the stringified URIs is an expensive operation. @@ -716,7 +716,7 @@ public class OpenIddictEntityFrameworkCoreApplicationStore.Empty); } // Note: parsing the stringified requirements is an expensive operation. diff --git a/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictEntityFrameworkCoreAuthorizationStore.cs b/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictEntityFrameworkCoreAuthorizationStore.cs index 5a854423..b2151a02 100644 --- a/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictEntityFrameworkCoreAuthorizationStore.cs +++ b/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictEntityFrameworkCoreAuthorizationStore.cs @@ -574,7 +574,7 @@ public class OpenIddictEntityFrameworkCoreAuthorizationStore.Empty); } // Note: parsing the stringified scopes is an expensive operation. diff --git a/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictEntityFrameworkCoreScopeStore.cs b/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictEntityFrameworkCoreScopeStore.cs index 6436df02..fd5a876a 100644 --- a/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictEntityFrameworkCoreScopeStore.cs +++ b/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictEntityFrameworkCoreScopeStore.cs @@ -423,7 +423,7 @@ public class OpenIddictEntityFrameworkCoreScopeStore : I if (string.IsNullOrEmpty(scope.Resources)) { - return new([]); + return new(ImmutableArray.Empty); } // Note: parsing the stringified resources is an expensive operation. diff --git a/src/OpenIddict.MongoDb/Stores/OpenIddictMongoDbApplicationStore.cs b/src/OpenIddict.MongoDb/Stores/OpenIddictMongoDbApplicationStore.cs index d6f50c5a..2ad0585a 100644 --- a/src/OpenIddict.MongoDb/Stores/OpenIddictMongoDbApplicationStore.cs +++ b/src/OpenIddict.MongoDb/Stores/OpenIddictMongoDbApplicationStore.cs @@ -323,7 +323,7 @@ public class OpenIddictMongoDbApplicationStore : IOpenIddictApplic if (application.Permissions is not { Count: > 0 }) { - return new([]); + return new(ImmutableArray.Empty); } return new(application.Permissions.ToImmutableArray()); @@ -340,7 +340,7 @@ public class OpenIddictMongoDbApplicationStore : IOpenIddictApplic if (application.PostLogoutRedirectUris is not { Count: > 0 }) { - return new([]); + return new(ImmutableArray.Empty); } return new(application.PostLogoutRedirectUris.ToImmutableArray()); @@ -381,7 +381,7 @@ public class OpenIddictMongoDbApplicationStore : IOpenIddictApplic if (application.RedirectUris is not { Count: > 0 }) { - return new([]); + return new(ImmutableArray.Empty); } return new(application.RedirectUris.ToImmutableArray()); @@ -397,7 +397,7 @@ public class OpenIddictMongoDbApplicationStore : IOpenIddictApplic if (application.Requirements is not { Count: > 0 }) { - return new([]); + return new(ImmutableArray.Empty); } return new(application.Requirements.ToImmutableArray()); diff --git a/src/OpenIddict.MongoDb/Stores/OpenIddictMongoDbAuthorizationStore.cs b/src/OpenIddict.MongoDb/Stores/OpenIddictMongoDbAuthorizationStore.cs index 233d1804..b57e126b 100644 --- a/src/OpenIddict.MongoDb/Stores/OpenIddictMongoDbAuthorizationStore.cs +++ b/src/OpenIddict.MongoDb/Stores/OpenIddictMongoDbAuthorizationStore.cs @@ -415,7 +415,7 @@ public class OpenIddictMongoDbAuthorizationStore : IOpenIddictAu if (authorization.Scopes is not { Count: > 0 }) { - return new([]); + return new(ImmutableArray.Empty); } return new(authorization.Scopes.ToImmutableArray()); diff --git a/src/OpenIddict.MongoDb/Stores/OpenIddictMongoDbScopeStore.cs b/src/OpenIddict.MongoDb/Stores/OpenIddictMongoDbScopeStore.cs index 1a9c9f77..d0b4dfcf 100644 --- a/src/OpenIddict.MongoDb/Stores/OpenIddictMongoDbScopeStore.cs +++ b/src/OpenIddict.MongoDb/Stores/OpenIddictMongoDbScopeStore.cs @@ -302,7 +302,7 @@ public class OpenIddictMongoDbScopeStore : IOpenIddictScopeStore if (scope.Resources is not { Count: > 0 }) { - return new([]); + return new(ImmutableArray.Empty); } return new(scope.Resources.ToImmutableArray()); diff --git a/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.Authentication.cs b/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.Authentication.cs index 1afe6cdc..f203bfd3 100644 --- a/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.Authentication.cs +++ b/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.Authentication.cs @@ -28,7 +28,7 @@ public static partial class OpenIddictServerAspNetCoreHandlers { public static class Authentication { - public static ImmutableArray DefaultHandlers { get; } = [ + public static ImmutableArray DefaultHandlers { get; } = ImmutableArray.Create([ /* * Authorization request extraction: */ @@ -53,7 +53,7 @@ public static partial class OpenIddictServerAspNetCoreHandlers ProcessPassthroughErrorResponse.Descriptor, ProcessStatusCodePagesErrorResponse.Descriptor, ProcessLocalErrorResponse.Descriptor - ]; + ]); /// /// Contains the logic responsible for restoring cached requests from the request_id, if specified. diff --git a/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.Device.cs b/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.Device.cs index 2a74055c..9e3b818c 100644 --- a/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.Device.cs +++ b/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.Device.cs @@ -14,7 +14,7 @@ public static partial class OpenIddictServerAspNetCoreHandlers { public static class Device { - public static ImmutableArray DefaultHandlers { get; } = [ + public static ImmutableArray DefaultHandlers { get; } = ImmutableArray.Create([ /* * Device request extraction: */ @@ -50,7 +50,7 @@ public static partial class OpenIddictServerAspNetCoreHandlers ProcessStatusCodePagesErrorResponse.Descriptor, ProcessLocalErrorResponse.Descriptor, ProcessEmptyResponse.Descriptor - ]; + ]); } /// diff --git a/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.Discovery.cs b/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.Discovery.cs index dea4b63d..b190cc6d 100644 --- a/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.Discovery.cs +++ b/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.Discovery.cs @@ -12,7 +12,7 @@ public static partial class OpenIddictServerAspNetCoreHandlers { public static class Discovery { - public static ImmutableArray DefaultHandlers { get; } = [ + public static ImmutableArray DefaultHandlers { get; } = ImmutableArray.Create([ /* * Configuration request extraction: */ @@ -36,6 +36,6 @@ public static partial class OpenIddictServerAspNetCoreHandlers AttachHttpResponseCode.Descriptor, AttachWwwAuthenticateHeader.Descriptor, ProcessJsonResponse.Descriptor - ]; + ]); } } diff --git a/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.Exchange.cs b/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.Exchange.cs index 34f79c73..7c97520c 100644 --- a/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.Exchange.cs +++ b/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.Exchange.cs @@ -12,7 +12,7 @@ public static partial class OpenIddictServerAspNetCoreHandlers { public static class Exchange { - public static ImmutableArray DefaultHandlers { get; } = [ + public static ImmutableArray DefaultHandlers { get; } = ImmutableArray.Create([ /* * Token request extraction: */ @@ -32,6 +32,6 @@ public static partial class OpenIddictServerAspNetCoreHandlers AttachCacheControlHeader.Descriptor, AttachWwwAuthenticateHeader.Descriptor, ProcessJsonResponse.Descriptor - ]; + ]); } } diff --git a/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.Introspection.cs b/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.Introspection.cs index 11c0c474..a6a67db9 100644 --- a/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.Introspection.cs +++ b/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.Introspection.cs @@ -12,7 +12,7 @@ public static partial class OpenIddictServerAspNetCoreHandlers { public static class Introspection { - public static ImmutableArray DefaultHandlers { get; } = [ + public static ImmutableArray DefaultHandlers { get; } = ImmutableArray.Create([ /* * Introspection request extraction: */ @@ -26,6 +26,6 @@ public static partial class OpenIddictServerAspNetCoreHandlers AttachHttpResponseCode.Descriptor, AttachWwwAuthenticateHeader.Descriptor, ProcessJsonResponse.Descriptor - ]; + ]); } } diff --git a/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.Revocation.cs b/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.Revocation.cs index c81f2282..36cdcba2 100644 --- a/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.Revocation.cs +++ b/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.Revocation.cs @@ -12,7 +12,7 @@ public static partial class OpenIddictServerAspNetCoreHandlers { public static class Revocation { - public static ImmutableArray DefaultHandlers { get; } = [ + public static ImmutableArray DefaultHandlers { get; } = ImmutableArray.Create([ /* * Revocation request extraction: */ @@ -27,6 +27,6 @@ public static partial class OpenIddictServerAspNetCoreHandlers AttachCacheControlHeader.Descriptor, AttachWwwAuthenticateHeader.Descriptor, ProcessJsonResponse.Descriptor - ]; + ]); } } diff --git a/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.Session.cs b/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.Session.cs index 1839ed9b..b1137f6f 100644 --- a/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.Session.cs +++ b/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.Session.cs @@ -25,7 +25,7 @@ public static partial class OpenIddictServerAspNetCoreHandlers { public static class Session { - public static ImmutableArray DefaultHandlers { get; } = [ + public static ImmutableArray DefaultHandlers { get; } = ImmutableArray.Create([ /* * Logout request extraction: */ @@ -50,7 +50,7 @@ public static partial class OpenIddictServerAspNetCoreHandlers ProcessLocalErrorResponse.Descriptor, ProcessQueryResponse.Descriptor, ProcessEmptyResponse.Descriptor - ]; + ]); /// /// Contains the logic responsible for restoring cached requests from the request_id, if specified. diff --git a/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.Userinfo.cs b/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.Userinfo.cs index f3857039..d9c1a292 100644 --- a/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.Userinfo.cs +++ b/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.Userinfo.cs @@ -12,7 +12,7 @@ public static partial class OpenIddictServerAspNetCoreHandlers { public static class Userinfo { - public static ImmutableArray DefaultHandlers { get; } = [ + public static ImmutableArray DefaultHandlers { get; } = ImmutableArray.Create([ /* * Userinfo request extraction: */ @@ -31,6 +31,6 @@ public static partial class OpenIddictServerAspNetCoreHandlers AttachWwwAuthenticateHeader.Descriptor, ProcessChallengeErrorResponse.Descriptor, ProcessJsonResponse.Descriptor - ]; + ]); } } diff --git a/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.cs b/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.cs index 5ddd28dd..1067737a 100644 --- a/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.cs +++ b/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.cs @@ -28,7 +28,7 @@ namespace OpenIddict.Server.AspNetCore; [EditorBrowsable(EditorBrowsableState.Never)] public static partial class OpenIddictServerAspNetCoreHandlers { - public static ImmutableArray DefaultHandlers { get; } = [ + public static ImmutableArray DefaultHandlers { get; } = ImmutableArray.Create([ /* * Top-level request processing: */ @@ -60,7 +60,7 @@ public static partial class OpenIddictServerAspNetCoreHandlers .. Revocation.DefaultHandlers, .. Session.DefaultHandlers, .. Userinfo.DefaultHandlers - ]; + ]); /// /// Contains the logic responsible for resolving the request URI from the ASP.NET Core environment. diff --git a/src/OpenIddict.Server.DataProtection/OpenIddictServerDataProtectionHandlers.Protection.cs b/src/OpenIddict.Server.DataProtection/OpenIddictServerDataProtectionHandlers.Protection.cs index 9716665a..1581687a 100644 --- a/src/OpenIddict.Server.DataProtection/OpenIddictServerDataProtectionHandlers.Protection.cs +++ b/src/OpenIddict.Server.DataProtection/OpenIddictServerDataProtectionHandlers.Protection.cs @@ -21,7 +21,7 @@ public static partial class OpenIddictServerDataProtectionHandlers { public static class Protection { - public static ImmutableArray DefaultHandlers { get; } = [ + public static ImmutableArray DefaultHandlers { get; } = ImmutableArray.Create([ /* * Token validation: */ @@ -32,7 +32,7 @@ public static partial class OpenIddictServerDataProtectionHandlers */ OverrideGeneratedTokenFormat.Descriptor, GenerateDataProtectionToken.Descriptor - ]; + ]); /// /// Contains the logic responsible for validating tokens generated using Data Protection. diff --git a/src/OpenIddict.Server.DataProtection/OpenIddictServerDataProtectionHandlers.cs b/src/OpenIddict.Server.DataProtection/OpenIddictServerDataProtectionHandlers.cs index a2827c7e..db1b618a 100644 --- a/src/OpenIddict.Server.DataProtection/OpenIddictServerDataProtectionHandlers.cs +++ b/src/OpenIddict.Server.DataProtection/OpenIddictServerDataProtectionHandlers.cs @@ -13,5 +13,5 @@ namespace OpenIddict.Server.DataProtection; public static partial class OpenIddictServerDataProtectionHandlers { public static ImmutableArray DefaultHandlers { get; } - = [.. Protection.DefaultHandlers]; + = ImmutableArray.Create([.. Protection.DefaultHandlers]); } diff --git a/src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.Authentication.cs b/src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.Authentication.cs index a3002340..3b02908a 100644 --- a/src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.Authentication.cs +++ b/src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.Authentication.cs @@ -26,7 +26,7 @@ public static partial class OpenIddictServerOwinHandlers { public static class Authentication { - public static ImmutableArray DefaultHandlers { get; } = [ + public static ImmutableArray DefaultHandlers { get; } = ImmutableArray.Create([ /* * Authorization request extraction: */ @@ -52,7 +52,7 @@ public static partial class OpenIddictServerOwinHandlers ProcessFragmentResponse.Descriptor, ProcessPassthroughErrorResponse.Descriptor, ProcessLocalErrorResponse.Descriptor - ]; + ]); /// /// Contains the logic responsible for restoring cached requests from the request_id, if specified. diff --git a/src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.Device.cs b/src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.Device.cs index b102e62d..18533aa7 100644 --- a/src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.Device.cs +++ b/src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.Device.cs @@ -14,7 +14,7 @@ public static partial class OpenIddictServerOwinHandlers { public static class Device { - public static ImmutableArray DefaultHandlers { get; } = [ + public static ImmutableArray DefaultHandlers { get; } = ImmutableArray.Create([ /* * Device request extraction: */ @@ -53,7 +53,7 @@ public static partial class OpenIddictServerOwinHandlers ProcessPassthroughErrorResponse.Descriptor, ProcessLocalErrorResponse.Descriptor, ProcessEmptyResponse.Descriptor - ]; + ]); } /// diff --git a/src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.Discovery.cs b/src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.Discovery.cs index 7827b55c..34bd3255 100644 --- a/src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.Discovery.cs +++ b/src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.Discovery.cs @@ -12,7 +12,7 @@ public static partial class OpenIddictServerOwinHandlers { public static class Discovery { - public static ImmutableArray DefaultHandlers { get; } = [ + public static ImmutableArray DefaultHandlers { get; } = ImmutableArray.Create([ /* * Configuration request extraction: */ @@ -40,6 +40,6 @@ public static partial class OpenIddictServerOwinHandlers SuppressFormsAuthenticationRedirect.Descriptor, AttachWwwAuthenticateHeader.Descriptor, ProcessJsonResponse.Descriptor - ]; + ]); } } diff --git a/src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.Exchange.cs b/src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.Exchange.cs index 7d0ab315..a121ab59 100644 --- a/src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.Exchange.cs +++ b/src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.Exchange.cs @@ -12,7 +12,7 @@ public static partial class OpenIddictServerOwinHandlers { public static class Exchange { - public static ImmutableArray DefaultHandlers { get; } = [ + public static ImmutableArray DefaultHandlers { get; } = ImmutableArray.Create([ /* * Token request extraction: */ @@ -34,6 +34,6 @@ public static partial class OpenIddictServerOwinHandlers AttachCacheControlHeader.Descriptor, AttachWwwAuthenticateHeader.Descriptor, ProcessJsonResponse.Descriptor - ]; + ]); } } diff --git a/src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.Introspection.cs b/src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.Introspection.cs index cdbe52a3..e644376b 100644 --- a/src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.Introspection.cs +++ b/src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.Introspection.cs @@ -12,7 +12,7 @@ public static partial class OpenIddictServerOwinHandlers { public static class Introspection { - public static ImmutableArray DefaultHandlers { get; } = [ + public static ImmutableArray DefaultHandlers { get; } = ImmutableArray.Create([ /* * Introspection request extraction: */ @@ -28,6 +28,6 @@ public static partial class OpenIddictServerOwinHandlers SuppressFormsAuthenticationRedirect.Descriptor, AttachWwwAuthenticateHeader.Descriptor, ProcessJsonResponse.Descriptor - ]; + ]); } } diff --git a/src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.Revocation.cs b/src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.Revocation.cs index 1f0a51f7..fd62f19a 100644 --- a/src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.Revocation.cs +++ b/src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.Revocation.cs @@ -12,7 +12,7 @@ public static partial class OpenIddictServerOwinHandlers { public static class Revocation { - public static ImmutableArray DefaultHandlers { get; } = [ + public static ImmutableArray DefaultHandlers { get; } = ImmutableArray.Create([ /* * Revocation request extraction: */ @@ -29,6 +29,6 @@ public static partial class OpenIddictServerOwinHandlers AttachCacheControlHeader.Descriptor, AttachWwwAuthenticateHeader.Descriptor, ProcessJsonResponse.Descriptor - ]; + ]); } } diff --git a/src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.Session.cs b/src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.Session.cs index d08229d1..6b17c8a1 100644 --- a/src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.Session.cs +++ b/src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.Session.cs @@ -24,7 +24,7 @@ public static partial class OpenIddictServerOwinHandlers { public static class Session { - public static ImmutableArray DefaultHandlers { get; } = [ + public static ImmutableArray DefaultHandlers { get; } = ImmutableArray.Create([ /* * Logout request extraction: */ @@ -50,7 +50,7 @@ public static partial class OpenIddictServerOwinHandlers ProcessLocalErrorResponse.Descriptor, ProcessQueryResponse.Descriptor, ProcessEmptyResponse.Descriptor - ]; + ]); /// /// Contains the logic responsible for restoring cached requests from the request_id, if specified. diff --git a/src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.Userinfo.cs b/src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.Userinfo.cs index 23addd07..bc9cb699 100644 --- a/src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.Userinfo.cs +++ b/src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.Userinfo.cs @@ -12,7 +12,7 @@ public static partial class OpenIddictServerOwinHandlers { public static class Userinfo { - public static ImmutableArray DefaultHandlers { get; } = [ + public static ImmutableArray DefaultHandlers { get; } = ImmutableArray.Create([ /* * Userinfo request extraction: */ @@ -33,6 +33,6 @@ public static partial class OpenIddictServerOwinHandlers AttachWwwAuthenticateHeader.Descriptor, ProcessChallengeErrorResponse.Descriptor, ProcessJsonResponse.Descriptor - ]; + ]); } } diff --git a/src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.cs b/src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.cs index 6aa2e1a4..2d8ea592 100644 --- a/src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.cs +++ b/src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.cs @@ -23,7 +23,7 @@ namespace OpenIddict.Server.Owin; [EditorBrowsable(EditorBrowsableState.Never)] public static partial class OpenIddictServerOwinHandlers { - public static ImmutableArray DefaultHandlers { get; } = [ + public static ImmutableArray DefaultHandlers { get; } = ImmutableArray.Create([ /* * Top-level request processing: */ @@ -55,7 +55,7 @@ public static partial class OpenIddictServerOwinHandlers .. Revocation.DefaultHandlers, .. Session.DefaultHandlers, .. Userinfo.DefaultHandlers - ]; + ]); /// /// Contains the logic responsible for resolving the request URI from the OWIN environment. diff --git a/src/OpenIddict.Server/OpenIddictServerHandlerDescriptor.cs b/src/OpenIddict.Server/OpenIddictServerHandlerDescriptor.cs index ac613631..b141bc6f 100644 --- a/src/OpenIddict.Server/OpenIddictServerHandlerDescriptor.cs +++ b/src/OpenIddict.Server/OpenIddictServerHandlerDescriptor.cs @@ -31,7 +31,7 @@ public sealed class OpenIddictServerHandlerDescriptor /// Gets the list of filters responsible for excluding the handler /// from the activated handlers if it doesn't meet the criteria. /// - public ImmutableArray FilterTypes { get; private set; } = []; + public ImmutableArray FilterTypes { get; private set; } = ImmutableArray.Empty; /// /// Gets the order assigned to the handler. diff --git a/src/OpenIddict.Server/OpenIddictServerHandlers.Authentication.cs b/src/OpenIddict.Server/OpenIddictServerHandlers.Authentication.cs index 05ab72e2..62e7f7a9 100644 --- a/src/OpenIddict.Server/OpenIddictServerHandlers.Authentication.cs +++ b/src/OpenIddict.Server/OpenIddictServerHandlers.Authentication.cs @@ -17,7 +17,7 @@ public static partial class OpenIddictServerHandlers { public static class Authentication { - public static ImmutableArray DefaultHandlers { get; } = [ + public static ImmutableArray DefaultHandlers { get; } = ImmutableArray.Create([ /* * Authorization request top-level processing: */ @@ -65,7 +65,7 @@ public static partial class OpenIddictServerHandlers InferResponseMode.Descriptor, AttachResponseState.Descriptor, AttachIssuer.Descriptor - ]; + ]); /// /// Contains the logic responsible for extracting authorization requests and invoking the corresponding event handlers. diff --git a/src/OpenIddict.Server/OpenIddictServerHandlers.Device.cs b/src/OpenIddict.Server/OpenIddictServerHandlers.Device.cs index 42a613d9..42b574a7 100644 --- a/src/OpenIddict.Server/OpenIddictServerHandlers.Device.cs +++ b/src/OpenIddict.Server/OpenIddictServerHandlers.Device.cs @@ -18,7 +18,7 @@ public static partial class OpenIddictServerHandlers { public static class Device { - public static ImmutableArray DefaultHandlers { get; } = [ + public static ImmutableArray DefaultHandlers { get; } = ImmutableArray.Create([ /* * Device request top-level processing: */ @@ -61,7 +61,7 @@ public static partial class OpenIddictServerHandlers * Verification request handling: */ AttachUserCodePrincipal.Descriptor - ]; + ]); /// /// Contains the logic responsible for extracting device requests and invoking the corresponding event handlers. diff --git a/src/OpenIddict.Server/OpenIddictServerHandlers.Discovery.cs b/src/OpenIddict.Server/OpenIddictServerHandlers.Discovery.cs index 4aaaf6ab..ab7d8f3b 100644 --- a/src/OpenIddict.Server/OpenIddictServerHandlers.Discovery.cs +++ b/src/OpenIddict.Server/OpenIddictServerHandlers.Discovery.cs @@ -18,7 +18,7 @@ public static partial class OpenIddictServerHandlers { public static class Discovery { - public static ImmutableArray DefaultHandlers { get; } = [ + public static ImmutableArray DefaultHandlers { get; } = ImmutableArray.Create([ /* * Configuration request top-level processing: */ @@ -57,7 +57,7 @@ public static partial class OpenIddictServerHandlers * Cryptography request handling: */ AttachSigningKeys.Descriptor - ]; + ]); /// /// Contains the logic responsible for extracting configuration requests and invoking the corresponding event handlers. diff --git a/src/OpenIddict.Server/OpenIddictServerHandlers.Exchange.cs b/src/OpenIddict.Server/OpenIddictServerHandlers.Exchange.cs index 97f493c6..7a0f6726 100644 --- a/src/OpenIddict.Server/OpenIddictServerHandlers.Exchange.cs +++ b/src/OpenIddict.Server/OpenIddictServerHandlers.Exchange.cs @@ -21,7 +21,7 @@ public static partial class OpenIddictServerHandlers { public static class Exchange { - public static ImmutableArray DefaultHandlers { get; } = [ + public static ImmutableArray DefaultHandlers { get; } = ImmutableArray.Create([ /* * Token request top-level processing: */ @@ -65,7 +65,7 @@ public static partial class OpenIddictServerHandlers * Token response handling: */ NormalizeErrorResponse.Descriptor - ]; + ]); /// /// Contains the logic responsible for extracting token requests and invoking the corresponding event handlers. diff --git a/src/OpenIddict.Server/OpenIddictServerHandlers.Introspection.cs b/src/OpenIddict.Server/OpenIddictServerHandlers.Introspection.cs index 85169f24..b12989e5 100644 --- a/src/OpenIddict.Server/OpenIddictServerHandlers.Introspection.cs +++ b/src/OpenIddict.Server/OpenIddictServerHandlers.Introspection.cs @@ -21,7 +21,7 @@ public static partial class OpenIddictServerHandlers { public static class Introspection { - public static ImmutableArray DefaultHandlers { get; } = [ + public static ImmutableArray DefaultHandlers { get; } = ImmutableArray.Create([ /* * Introspection request top-level processing: */ @@ -52,7 +52,7 @@ public static partial class OpenIddictServerHandlers * Introspection response handling: */ NormalizeErrorResponse.Descriptor - ]; + ]); /// /// Contains the logic responsible for extracting introspection requests and invoking the corresponding event handlers. diff --git a/src/OpenIddict.Server/OpenIddictServerHandlers.Protection.cs b/src/OpenIddict.Server/OpenIddictServerHandlers.Protection.cs index 807ff6d2..fbef40a1 100644 --- a/src/OpenIddict.Server/OpenIddictServerHandlers.Protection.cs +++ b/src/OpenIddict.Server/OpenIddictServerHandlers.Protection.cs @@ -22,7 +22,7 @@ public static partial class OpenIddictServerHandlers { public static class Protection { - public static ImmutableArray DefaultHandlers { get; } = [ + public static ImmutableArray DefaultHandlers { get; } = ImmutableArray.Create([ /* * Token validation: */ @@ -45,7 +45,7 @@ public static partial class OpenIddictServerHandlers GenerateIdentityModelToken.Descriptor, AttachTokenPayload.Descriptor, BeautifyToken.Descriptor - ]; + ]); /// /// Contains the logic responsible for resolving the validation parameters used to validate tokens. diff --git a/src/OpenIddict.Server/OpenIddictServerHandlers.Revocation.cs b/src/OpenIddict.Server/OpenIddictServerHandlers.Revocation.cs index ea8ba325..3aedeb0c 100644 --- a/src/OpenIddict.Server/OpenIddictServerHandlers.Revocation.cs +++ b/src/OpenIddict.Server/OpenIddictServerHandlers.Revocation.cs @@ -15,7 +15,7 @@ public static partial class OpenIddictServerHandlers { public static class Revocation { - public static ImmutableArray DefaultHandlers { get; } = [ + public static ImmutableArray DefaultHandlers { get; } = ImmutableArray.Create([ /* * Revocation request top-level processing: */ @@ -45,7 +45,7 @@ public static partial class OpenIddictServerHandlers * Revocation response handling: */ NormalizeErrorResponse.Descriptor - ]; + ]); /// /// Contains the logic responsible for extracting revocation requests and invoking the corresponding event handlers. diff --git a/src/OpenIddict.Server/OpenIddictServerHandlers.Session.cs b/src/OpenIddict.Server/OpenIddictServerHandlers.Session.cs index a8f00526..610a23ff 100644 --- a/src/OpenIddict.Server/OpenIddictServerHandlers.Session.cs +++ b/src/OpenIddict.Server/OpenIddictServerHandlers.Session.cs @@ -18,7 +18,7 @@ public static partial class OpenIddictServerHandlers { public static class Session { - public static ImmutableArray DefaultHandlers { get; } = [ + public static ImmutableArray DefaultHandlers { get; } = ImmutableArray.Create([ /* * Logout request top-level processing: */ @@ -48,7 +48,7 @@ public static partial class OpenIddictServerHandlers */ AttachPostLogoutRedirectUri.Descriptor, AttachResponseState.Descriptor - ]; + ]); /// /// Contains the logic responsible for extracting logout requests and invoking the corresponding event handlers. diff --git a/src/OpenIddict.Server/OpenIddictServerHandlers.Userinfo.cs b/src/OpenIddict.Server/OpenIddictServerHandlers.Userinfo.cs index cae54df5..cef0b9e9 100644 --- a/src/OpenIddict.Server/OpenIddictServerHandlers.Userinfo.cs +++ b/src/OpenIddict.Server/OpenIddictServerHandlers.Userinfo.cs @@ -15,7 +15,7 @@ public static partial class OpenIddictServerHandlers { public static class Userinfo { - public static ImmutableArray DefaultHandlers { get; } = [ + public static ImmutableArray DefaultHandlers { get; } = ImmutableArray.Create([ /* * Userinfo request top-level processing: */ @@ -38,7 +38,7 @@ public static partial class OpenIddictServerHandlers AttachPrincipal.Descriptor, AttachAudiences.Descriptor, AttachClaims.Descriptor - ]; + ]); /// /// Contains the logic responsible for extracting userinfo requests and invoking the corresponding event handlers. diff --git a/src/OpenIddict.Server/OpenIddictServerHandlers.cs b/src/OpenIddict.Server/OpenIddictServerHandlers.cs index 2a924c72..dbf0124f 100644 --- a/src/OpenIddict.Server/OpenIddictServerHandlers.cs +++ b/src/OpenIddict.Server/OpenIddictServerHandlers.cs @@ -22,7 +22,7 @@ namespace OpenIddict.Server; [EditorBrowsable(EditorBrowsableState.Never)] public static partial class OpenIddictServerHandlers { - public static ImmutableArray DefaultHandlers { get; } = [ + public static ImmutableArray DefaultHandlers { get; } = ImmutableArray.Create([ /* * Top-level request processing: */ @@ -116,7 +116,7 @@ public static partial class OpenIddictServerHandlers .. Revocation.DefaultHandlers, .. Session.DefaultHandlers, .. Userinfo.DefaultHandlers - ]; + ]); /// /// Contains the logic responsible for inferring the endpoint type from the request URI. @@ -2497,7 +2497,7 @@ public static partial class OpenIddictServerHandlers } // Reset the audiences collection, as it's later set, based on the token type. - context.Principal.SetAudiences(ImmutableArray.Create()); + context.Principal.SetAudiences(ImmutableArray.Empty); return default; } diff --git a/src/OpenIddict.Validation.AspNetCore/OpenIddictValidationAspNetCoreHandlers.cs b/src/OpenIddict.Validation.AspNetCore/OpenIddictValidationAspNetCoreHandlers.cs index ffff9d2c..4d36183d 100644 --- a/src/OpenIddict.Validation.AspNetCore/OpenIddictValidationAspNetCoreHandlers.cs +++ b/src/OpenIddict.Validation.AspNetCore/OpenIddictValidationAspNetCoreHandlers.cs @@ -26,7 +26,7 @@ namespace OpenIddict.Validation.AspNetCore; [EditorBrowsable(EditorBrowsableState.Never)] public static partial class OpenIddictValidationAspNetCoreHandlers { - public static ImmutableArray DefaultHandlers { get; } = [ + public static ImmutableArray DefaultHandlers { get; } = ImmutableArray.Create([ /* * Request top-level processing: */ @@ -58,7 +58,7 @@ public static partial class OpenIddictValidationAspNetCoreHandlers AttachCacheControlHeader.Descriptor, AttachWwwAuthenticateHeader.Descriptor, ProcessChallengeErrorResponse.Descriptor - ]; + ]); /// /// Contains the logic responsible for resolving the request URI from the ASP.NET Core environment. diff --git a/src/OpenIddict.Validation.DataProtection/OpenIddictValidationDataProtectionHandlers.Protection.cs b/src/OpenIddict.Validation.DataProtection/OpenIddictValidationDataProtectionHandlers.Protection.cs index bff7fc6c..c13fd25a 100644 --- a/src/OpenIddict.Validation.DataProtection/OpenIddictValidationDataProtectionHandlers.Protection.cs +++ b/src/OpenIddict.Validation.DataProtection/OpenIddictValidationDataProtectionHandlers.Protection.cs @@ -21,12 +21,12 @@ public static partial class OpenIddictValidationDataProtectionHandlers { public static class Protection { - public static ImmutableArray DefaultHandlers { get; } = [ + public static ImmutableArray DefaultHandlers { get; } = ImmutableArray.Create([ /* * Token validation: */ ValidateDataProtectionToken.Descriptor - ]; + ]); /// /// Contains the logic responsible for validating tokens generated using Data Protection. diff --git a/src/OpenIddict.Validation.DataProtection/OpenIddictValidationDataProtectionHandlers.cs b/src/OpenIddict.Validation.DataProtection/OpenIddictValidationDataProtectionHandlers.cs index 50e97d70..61e672a0 100644 --- a/src/OpenIddict.Validation.DataProtection/OpenIddictValidationDataProtectionHandlers.cs +++ b/src/OpenIddict.Validation.DataProtection/OpenIddictValidationDataProtectionHandlers.cs @@ -13,5 +13,5 @@ namespace OpenIddict.Validation.DataProtection; public static partial class OpenIddictValidationDataProtectionHandlers { public static ImmutableArray DefaultHandlers { get; } - = [.. Protection.DefaultHandlers]; + = ImmutableArray.Create([.. Protection.DefaultHandlers]); } diff --git a/src/OpenIddict.Validation.Owin/OpenIddictValidationOwinHandlers.cs b/src/OpenIddict.Validation.Owin/OpenIddictValidationOwinHandlers.cs index ef10c56a..6ebbd5c5 100644 --- a/src/OpenIddict.Validation.Owin/OpenIddictValidationOwinHandlers.cs +++ b/src/OpenIddict.Validation.Owin/OpenIddictValidationOwinHandlers.cs @@ -22,7 +22,7 @@ namespace OpenIddict.Validation.Owin; [EditorBrowsable(EditorBrowsableState.Never)] public static partial class OpenIddictValidationOwinHandlers { - public static ImmutableArray DefaultHandlers { get; } = [ + public static ImmutableArray DefaultHandlers { get; } = ImmutableArray.Create([ /* * Request top-level processing: */ @@ -57,7 +57,7 @@ public static partial class OpenIddictValidationOwinHandlers AttachCacheControlHeader.Descriptor, AttachWwwAuthenticateHeader.Descriptor, ProcessChallengeErrorResponse.Descriptor - ]; + ]); /// /// Contains the logic responsible for resolving the request URI from the OWIN environment. diff --git a/src/OpenIddict.Validation.SystemNetHttp/OpenIddictValidationSystemNetHttpHandlers.Discovery.cs b/src/OpenIddict.Validation.SystemNetHttp/OpenIddictValidationSystemNetHttpHandlers.Discovery.cs index 5c8cc5d7..379b124b 100644 --- a/src/OpenIddict.Validation.SystemNetHttp/OpenIddictValidationSystemNetHttpHandlers.Discovery.cs +++ b/src/OpenIddict.Validation.SystemNetHttp/OpenIddictValidationSystemNetHttpHandlers.Discovery.cs @@ -12,7 +12,7 @@ public static partial class OpenIddictValidationSystemNetHttpHandlers { public static class Discovery { - public static ImmutableArray DefaultHandlers { get; } = [ + public static ImmutableArray DefaultHandlers { get; } = ImmutableArray.Create([ /* * Configuration request processing: */ @@ -56,6 +56,6 @@ public static partial class OpenIddictValidationSystemNetHttpHandlers ExtractWwwAuthenticateHeader.Descriptor, ValidateHttpResponse.Descriptor, DisposeHttpResponse.Descriptor - ]; + ]); } } diff --git a/src/OpenIddict.Validation.SystemNetHttp/OpenIddictValidationSystemNetHttpHandlers.Introspection.cs b/src/OpenIddict.Validation.SystemNetHttp/OpenIddictValidationSystemNetHttpHandlers.Introspection.cs index 3ef6afb0..14ecf0d8 100644 --- a/src/OpenIddict.Validation.SystemNetHttp/OpenIddictValidationSystemNetHttpHandlers.Introspection.cs +++ b/src/OpenIddict.Validation.SystemNetHttp/OpenIddictValidationSystemNetHttpHandlers.Introspection.cs @@ -16,7 +16,7 @@ public static partial class OpenIddictValidationSystemNetHttpHandlers { public static class Introspection { - public static ImmutableArray DefaultHandlers { get; } = [ + public static ImmutableArray DefaultHandlers { get; } = ImmutableArray.Create([ /* * Introspection request processing: */ @@ -39,7 +39,7 @@ public static partial class OpenIddictValidationSystemNetHttpHandlers ExtractWwwAuthenticateHeader.Descriptor, ValidateHttpResponse.Descriptor, DisposeHttpResponse.Descriptor - ]; + ]); /// /// Contains the logic responsible for attaching the client credentials to the HTTP Authorization header. diff --git a/src/OpenIddict.Validation.SystemNetHttp/OpenIddictValidationSystemNetHttpHandlers.cs b/src/OpenIddict.Validation.SystemNetHttp/OpenIddictValidationSystemNetHttpHandlers.cs index 2e3e542a..16b74354 100644 --- a/src/OpenIddict.Validation.SystemNetHttp/OpenIddictValidationSystemNetHttpHandlers.cs +++ b/src/OpenIddict.Validation.SystemNetHttp/OpenIddictValidationSystemNetHttpHandlers.cs @@ -22,7 +22,7 @@ namespace OpenIddict.Validation.SystemNetHttp; public static partial class OpenIddictValidationSystemNetHttpHandlers { public static ImmutableArray DefaultHandlers { get; } - = [.. Discovery.DefaultHandlers, .. Introspection.DefaultHandlers]; + = ImmutableArray.Create([.. Discovery.DefaultHandlers, .. Introspection.DefaultHandlers]); /// /// Contains the logic responsible for creating and attaching a . diff --git a/src/OpenIddict.Validation/OpenIddictValidationHandlerDescriptor.cs b/src/OpenIddict.Validation/OpenIddictValidationHandlerDescriptor.cs index 09d72bb9..93831036 100644 --- a/src/OpenIddict.Validation/OpenIddictValidationHandlerDescriptor.cs +++ b/src/OpenIddict.Validation/OpenIddictValidationHandlerDescriptor.cs @@ -31,7 +31,7 @@ public sealed class OpenIddictValidationHandlerDescriptor /// Gets the list of filters responsible for excluding the handler /// from the activated handlers if it doesn't meet the criteria. /// - public ImmutableArray FilterTypes { get; private set; } = []; + public ImmutableArray FilterTypes { get; private set; } = ImmutableArray.Empty; /// /// Gets the order assigned to the handler. diff --git a/src/OpenIddict.Validation/OpenIddictValidationHandlers.Discovery.cs b/src/OpenIddict.Validation/OpenIddictValidationHandlers.Discovery.cs index 406aea70..c66c69b7 100644 --- a/src/OpenIddict.Validation/OpenIddictValidationHandlers.Discovery.cs +++ b/src/OpenIddict.Validation/OpenIddictValidationHandlers.Discovery.cs @@ -15,7 +15,7 @@ public static partial class OpenIddictValidationHandlers { public static class Discovery { - public static ImmutableArray DefaultHandlers { get; } = [ + public static ImmutableArray DefaultHandlers { get; } = ImmutableArray.Create([ /* * Configuration response handling: */ @@ -32,7 +32,7 @@ public static partial class OpenIddictValidationHandlers ValidateWellKnownCryptographyParameters.Descriptor, HandleCryptographyErrorResponse.Descriptor, ExtractSigningKeys.Descriptor - ]; + ]); /// /// Contains the logic responsible for validating the well-known parameters contained in the configuration response. diff --git a/src/OpenIddict.Validation/OpenIddictValidationHandlers.Introspection.cs b/src/OpenIddict.Validation/OpenIddictValidationHandlers.Introspection.cs index f70121e9..2120c188 100644 --- a/src/OpenIddict.Validation/OpenIddictValidationHandlers.Introspection.cs +++ b/src/OpenIddict.Validation/OpenIddictValidationHandlers.Introspection.cs @@ -17,7 +17,7 @@ public static partial class OpenIddictValidationHandlers { public static class Introspection { - public static ImmutableArray DefaultHandlers { get; } = [ + public static ImmutableArray DefaultHandlers { get; } = ImmutableArray.Create([ /* * Introspection response handling: */ @@ -29,7 +29,7 @@ public static partial class OpenIddictValidationHandlers ValidateTokenUsage.Descriptor, PopulateClaims.Descriptor, MapInternalClaims.Descriptor - ]; + ]); /// /// Contains the logic responsible for validating the well-known parameters contained in the introspection response. @@ -507,7 +507,7 @@ public static partial class OpenIddictValidationHandlers string identifier when !string.IsNullOrEmpty(identifier) => ImmutableArray.Create(identifier), - _ => [] + _ => ImmutableArray.Empty }); // Map the internal "oi_scp" claims from the standard, space-separated "scope" claim, if available. @@ -515,7 +515,7 @@ public static partial class OpenIddictValidationHandlers { string scope => scope.Split(Separators.Space, StringSplitOptions.RemoveEmptyEntries).ToImmutableArray(), - _ => [] + _ => ImmutableArray.Empty }); return default; diff --git a/src/OpenIddict.Validation/OpenIddictValidationHandlers.Protection.cs b/src/OpenIddict.Validation/OpenIddictValidationHandlers.Protection.cs index ad6df128..104e7957 100644 --- a/src/OpenIddict.Validation/OpenIddictValidationHandlers.Protection.cs +++ b/src/OpenIddict.Validation/OpenIddictValidationHandlers.Protection.cs @@ -17,7 +17,7 @@ public static partial class OpenIddictValidationHandlers { public static class Protection { - public static ImmutableArray DefaultHandlers { get; } = [ + public static ImmutableArray DefaultHandlers { get; } = ImmutableArray.Create([ /* * Token validation: */ @@ -38,7 +38,7 @@ public static partial class OpenIddictValidationHandlers */ AttachSecurityCredentials.Descriptor, GenerateIdentityModelToken.Descriptor - ]; + ]); /// /// Contains the logic responsible for resolving the validation parameters used to validate tokens. diff --git a/src/OpenIddict.Validation/OpenIddictValidationHandlers.cs b/src/OpenIddict.Validation/OpenIddictValidationHandlers.cs index 7726e7f3..c1f0354d 100644 --- a/src/OpenIddict.Validation/OpenIddictValidationHandlers.cs +++ b/src/OpenIddict.Validation/OpenIddictValidationHandlers.cs @@ -18,7 +18,7 @@ namespace OpenIddict.Validation; [EditorBrowsable(EditorBrowsableState.Never)] public static partial class OpenIddictValidationHandlers { - public static ImmutableArray DefaultHandlers { get; } = [ + public static ImmutableArray DefaultHandlers { get; } = ImmutableArray.Create([ /* * Authentication processing: */ @@ -52,7 +52,7 @@ public static partial class OpenIddictValidationHandlers .. Discovery.DefaultHandlers, .. Introspection.DefaultHandlers, .. Protection.DefaultHandlers - ]; + ]); /// /// Contains the logic responsible for selecting the token types that should be validated. diff --git a/test/OpenIddict.Abstractions.Tests/Primitives/OpenIddictExtensionsTests.cs b/test/OpenIddict.Abstractions.Tests/Primitives/OpenIddictExtensionsTests.cs index c5eb9127..030d5c73 100644 --- a/test/OpenIddict.Abstractions.Tests/Primitives/OpenIddictExtensionsTests.cs +++ b/test/OpenIddict.Abstractions.Tests/Primitives/OpenIddictExtensionsTests.cs @@ -2084,7 +2084,7 @@ public class OpenIddictExtensionsTests var identity = (ClaimsIdentity) null!; // Act and assert - var exception = Assert.Throws(() => identity.AddClaims("type", [])); + var exception = Assert.Throws(() => identity.AddClaims("type", ImmutableArray.Empty)); Assert.Equal("identity", exception.ParamName); } @@ -2096,7 +2096,7 @@ public class OpenIddictExtensionsTests var principal = (ClaimsPrincipal) null!; // Act and assert - var exception = Assert.Throws(() => principal.AddClaims("type", [])); + var exception = Assert.Throws(() => principal.AddClaims("type", ImmutableArray.Empty)); Assert.Equal("principal", exception.ParamName); } @@ -2108,7 +2108,7 @@ public class OpenIddictExtensionsTests var principal = new ClaimsPrincipal(); // Act and assert - var exception = Assert.Throws(() => principal.AddClaims("type", ["value1", "value2"])); + var exception = Assert.Throws(() => principal.AddClaims("type", ImmutableArray.Create("value1", "value2"))); Assert.Equal("principal", exception.ParamName); Assert.StartsWith(SR.GetResourceString(SR.ID0286), exception.Message); @@ -2123,7 +2123,7 @@ public class OpenIddictExtensionsTests var identity = new ClaimsIdentity(); // Act and assert - var exception = Assert.Throws(() => identity.AddClaims(type, [])); + var exception = Assert.Throws(() => identity.AddClaims(type, ImmutableArray.Empty)); Assert.Equal("type", exception.ParamName); Assert.StartsWith(SR.GetResourceString(SR.ID0184), exception.Message); @@ -2138,7 +2138,7 @@ public class OpenIddictExtensionsTests var principal = new ClaimsPrincipal(new ClaimsIdentity()); // Act and assert - var exception = Assert.Throws(() => principal.AddClaims(type, [])); + var exception = Assert.Throws(() => principal.AddClaims(type, ImmutableArray.Empty)); Assert.Equal("type", exception.ParamName); Assert.StartsWith(SR.GetResourceString(SR.ID0184), exception.Message); @@ -2151,7 +2151,7 @@ public class OpenIddictExtensionsTests var identity = new ClaimsIdentity(); // Act - identity.AddClaims("type", ["value1", "value2"], "issuer"); + identity.AddClaims("type", ImmutableArray.Create("value1", "value2"), "issuer"); // Assert var claims = identity.FindAll("type").ToArray(); @@ -2171,7 +2171,7 @@ public class OpenIddictExtensionsTests var principal = new ClaimsPrincipal(new ClaimsIdentity()); // Act - principal.AddClaims("type", ["value1", "value2"], "issuer"); + principal.AddClaims("type", ImmutableArray.Create("value1", "value2"), "issuer"); // Assert var claims = principal.FindAll("type").ToArray(); @@ -2191,10 +2191,10 @@ public class OpenIddictExtensionsTests var identity = new ClaimsIdentity(); // Act - identity.AddClaims("TYPE", ["value1", "value2"]); + identity.AddClaims("TYPE", ImmutableArray.Create("value1", "value2")); // Assert - Assert.Equal(["value1", "value2"], identity.GetClaims("type")); + Assert.Equal(ImmutableArray.Create("value1", "value2"), identity.GetClaims("type")); } [Fact] @@ -2204,10 +2204,10 @@ public class OpenIddictExtensionsTests var principal = new ClaimsPrincipal(new ClaimsIdentity()); // Act - principal.AddClaims("TYPE", ["value1", "value2"]); + principal.AddClaims("TYPE", ImmutableArray.Create("value1", "value2")); // Assert - Assert.Equal(["value1", "value2"], principal.GetClaims("type")); + Assert.Equal(ImmutableArray.Create("value1", "value2"), principal.GetClaims("type")); } [Fact] @@ -3612,7 +3612,7 @@ public class OpenIddictExtensionsTests var identity = (ClaimsIdentity) null!; // Act and assert - var exception = Assert.Throws(() => identity.SetClaims("type", [])); + var exception = Assert.Throws(() => identity.SetClaims("type", ImmutableArray.Empty)); Assert.Equal("identity", exception.ParamName); } @@ -3624,7 +3624,7 @@ public class OpenIddictExtensionsTests var principal = (ClaimsPrincipal) null!; // Act and assert - var exception = Assert.Throws(() => principal.SetClaims("type", [])); + var exception = Assert.Throws(() => principal.SetClaims("type", ImmutableArray.Empty)); Assert.Equal("principal", exception.ParamName); } @@ -3636,7 +3636,7 @@ public class OpenIddictExtensionsTests var principal = new ClaimsPrincipal(); // Act and assert - var exception = Assert.Throws(() => principal.SetClaims("type", ["value1", "value2"])); + var exception = Assert.Throws(() => principal.SetClaims("type", ImmutableArray.Create("value1", "value2"))); Assert.Equal("principal", exception.ParamName); Assert.StartsWith(SR.GetResourceString(SR.ID0286), exception.Message); @@ -3651,7 +3651,7 @@ public class OpenIddictExtensionsTests var identity = new ClaimsIdentity(); // Act and assert - var exception = Assert.Throws(() => identity.SetClaims(type, [])); + var exception = Assert.Throws(() => identity.SetClaims(type, ImmutableArray.Empty)); Assert.Equal("type", exception.ParamName); Assert.StartsWith(SR.GetResourceString(SR.ID0184), exception.Message); @@ -3666,7 +3666,7 @@ public class OpenIddictExtensionsTests var principal = new ClaimsPrincipal(new ClaimsIdentity()); // Act and assert - var exception = Assert.Throws(() => principal.SetClaims(type, [])); + var exception = Assert.Throws(() => principal.SetClaims(type, ImmutableArray.Empty)); Assert.Equal("type", exception.ParamName); Assert.StartsWith(SR.GetResourceString(SR.ID0184), exception.Message); @@ -3679,7 +3679,7 @@ public class OpenIddictExtensionsTests var identity = new ClaimsIdentity(); // Act - identity.SetClaims("type", ["value1", "value2"], "issuer"); + identity.SetClaims("type", ImmutableArray.Create("value1", "value2"), "issuer"); // Assert var claims = identity.FindAll("type").ToArray(); @@ -3699,7 +3699,7 @@ public class OpenIddictExtensionsTests var principal = new ClaimsPrincipal(new ClaimsIdentity()); // Act - principal.SetClaims("type", ["value1", "value2"], "issuer"); + principal.SetClaims("type", ImmutableArray.Create("value1", "value2"), "issuer"); // Assert var claims = principal.FindAll("type").ToArray(); @@ -3718,10 +3718,10 @@ public class OpenIddictExtensionsTests var identity = new ClaimsIdentity(); // Act - identity.SetClaims("TYPE", ["value1", "value2"]); + identity.SetClaims("TYPE", ImmutableArray.Create("value1", "value2")); // Assert - Assert.Equal(["value1", "value2"], identity.GetClaims("type")); + Assert.Equal(ImmutableArray.Create("value1", "value2"), identity.GetClaims("type")); } [Fact] @@ -3731,10 +3731,10 @@ public class OpenIddictExtensionsTests var principal = new ClaimsPrincipal(new ClaimsIdentity()); // Act - principal.SetClaims("TYPE", ["value1", "value2"]); + principal.SetClaims("TYPE", ImmutableArray.Create("value1", "value2")); // Assert - Assert.Equal(["value1", "value2"], principal.GetClaims("type")); + Assert.Equal(ImmutableArray.Create("value1", "value2"), principal.GetClaims("type")); } [Fact] @@ -3745,7 +3745,7 @@ public class OpenIddictExtensionsTests identity.AddClaim("type", "value"); // Act - identity.SetClaims("type", []); + identity.SetClaims("type", ImmutableArray.Empty); // Assert Assert.Empty(identity.GetClaims("type")); @@ -3759,7 +3759,7 @@ public class OpenIddictExtensionsTests principal.AddClaim("type", "value"); // Act - principal.SetClaims("type", []); + principal.SetClaims("type", ImmutableArray.Empty); // Assert Assert.Empty(principal.GetClaims("type")); diff --git a/test/OpenIddict.Server.IntegrationTests/OpenIddictServerIntegrationTests.Authentication.cs b/test/OpenIddict.Server.IntegrationTests/OpenIddictServerIntegrationTests.Authentication.cs index 2a005e51..9f363d00 100644 --- a/test/OpenIddict.Server.IntegrationTests/OpenIddictServerIntegrationTests.Authentication.cs +++ b/test/OpenIddict.Server.IntegrationTests/OpenIddictServerIntegrationTests.Authentication.cs @@ -1202,7 +1202,7 @@ public abstract partial class OpenIddictServerIntegrationTests .ReturnsAsync(true); mock.Setup(manager => manager.GetPermissionsAsync(application, It.IsAny())) - .ReturnsAsync([]); + .ReturnsAsync(ImmutableArray.Empty); }); await using var server = await CreateServerAsync(options => @@ -1378,7 +1378,7 @@ public abstract partial class OpenIddictServerIntegrationTests .ReturnsAsync(true); mock.Setup(manager => manager.GetPermissionsAsync(application, It.IsAny())) - .ReturnsAsync([]); + .ReturnsAsync(ImmutableArray.Empty); }); await using var server = await CreateServerAsync(options => @@ -1425,7 +1425,7 @@ public abstract partial class OpenIddictServerIntegrationTests .ReturnsAsync(application); mock.Setup(manager => manager.GetPermissionsAsync(application, It.IsAny())) - .ReturnsAsync(["rst:" + type]); + .ReturnsAsync(ImmutableArray.Create("rst:" + type)); mock.Setup(manager => manager.ValidateRedirectUriAsync(application, "http://www.fabrikam.com/path", It.IsAny())) .ReturnsAsync(true); diff --git a/test/OpenIddict.Server.IntegrationTests/OpenIddictServerIntegrationTests.Exchange.cs b/test/OpenIddict.Server.IntegrationTests/OpenIddictServerIntegrationTests.Exchange.cs index e6ca8ca9..7bb9ddcf 100644 --- a/test/OpenIddict.Server.IntegrationTests/OpenIddictServerIntegrationTests.Exchange.cs +++ b/test/OpenIddict.Server.IntegrationTests/OpenIddictServerIntegrationTests.Exchange.cs @@ -2816,7 +2816,7 @@ public abstract partial class OpenIddictServerIntegrationTests public async Task HandleTokenRequest_RevokesTokensWhenAuthorizationCodeIsAlreadyRedeemed() { // Arrange - ImmutableArray tokens = [new(), new(), new()]; + var tokens = ImmutableArray.Create(new OpenIddictToken(), new OpenIddictToken(), new OpenIddictToken()); var manager = CreateTokenManager(mock => { @@ -2915,7 +2915,7 @@ public abstract partial class OpenIddictServerIntegrationTests public async Task HandleTokenRequest_RevokesTokensWhenRefreshTokenIsAlreadyRedeemedAndLeewayIsNull() { // Arrange - ImmutableArray tokens = [new(), new(), new()]; + var tokens = ImmutableArray.Create(new OpenIddictToken(), new OpenIddictToken(), new OpenIddictToken()); var manager = CreateTokenManager(mock => { @@ -3006,7 +3006,7 @@ public abstract partial class OpenIddictServerIntegrationTests public async Task HandleTokenRequest_RevokesTokensWhenRefreshTokenIsAlreadyRedeemedAndCannotBeReused() { // Arrange - ImmutableArray tokens = [new(), new(), new()]; + var tokens = ImmutableArray.Create(new OpenIddictToken(), new OpenIddictToken(), new OpenIddictToken()); var manager = CreateTokenManager(mock => { @@ -3097,7 +3097,7 @@ public abstract partial class OpenIddictServerIntegrationTests public async Task HandleTokenRequest_DoesNotRevokeTokensWhenRefreshTokenIsAlreadyRedeemedAndCanBeReused() { // Arrange - ImmutableArray tokens = [new(), new(), new()]; + var tokens = ImmutableArray.Create(new OpenIddictToken(), new OpenIddictToken(), new OpenIddictToken()); var manager = CreateTokenManager(mock => { diff --git a/test/OpenIddict.Server.IntegrationTests/OpenIddictServerIntegrationTests.Protection.cs b/test/OpenIddict.Server.IntegrationTests/OpenIddictServerIntegrationTests.Protection.cs index e022878e..f58ff5a1 100644 --- a/test/OpenIddict.Server.IntegrationTests/OpenIddictServerIntegrationTests.Protection.cs +++ b/test/OpenIddict.Server.IntegrationTests/OpenIddictServerIntegrationTests.Protection.cs @@ -6,6 +6,7 @@ * the license and the contributors participating to this project. */ +using System.Collections.Immutable; using System.Security.Claims; using Xunit; using static OpenIddict.Server.OpenIddictServerEvents; @@ -296,7 +297,7 @@ public abstract partial class OpenIddictServerIntegrationTests context.Principal = new ClaimsPrincipal(new ClaimsIdentity("Bearer")) .SetTokenType(TokenTypeHints.AccessToken) .SetClaim(Claims.Subject, "Bob le Magnifique") - .SetClaims(Claims.Audience, ["Fabrikam", "Contoso"]); + .SetClaims(Claims.Audience, ImmutableArray.Create("Fabrikam", "Contoso")); return default; }); @@ -346,7 +347,7 @@ public abstract partial class OpenIddictServerIntegrationTests context.Principal = new ClaimsPrincipal(new ClaimsIdentity("Bearer")) .SetTokenType(TokenTypeHints.AccessToken) .SetClaim(Claims.Subject, "Bob le Magnifique") - .SetClaims(Claims.Scope, [Scopes.OpenId, Scopes.Profile]); + .SetClaims(Claims.Scope, ImmutableArray.Create(Scopes.OpenId, Scopes.Profile)); return default; }); @@ -444,7 +445,7 @@ public abstract partial class OpenIddictServerIntegrationTests context.Principal = new ClaimsPrincipal(new ClaimsIdentity("Bearer")) .SetTokenType(TokenTypeHints.AccessToken) .SetClaim(Claims.Subject, "Bob le Magnifique") - .SetClaims(Claims.Scope, [Scopes.OpenId, Scopes.Profile]); + .SetClaims(Claims.Scope, ImmutableArray.Create(Scopes.OpenId, Scopes.Profile)); return default; }); diff --git a/test/OpenIddict.Server.IntegrationTests/OpenIddictServerIntegrationTests.Session.cs b/test/OpenIddict.Server.IntegrationTests/OpenIddictServerIntegrationTests.Session.cs index ab1e3794..6d50d4a1 100644 --- a/test/OpenIddict.Server.IntegrationTests/OpenIddictServerIntegrationTests.Session.cs +++ b/test/OpenIddict.Server.IntegrationTests/OpenIddictServerIntegrationTests.Session.cs @@ -4,6 +4,7 @@ * the license and the contributors participating to this project. */ +using System.Collections.Immutable; using System.Net.Http; using System.Security.Claims; using Microsoft.Extensions.DependencyInjection; @@ -414,7 +415,7 @@ public abstract partial class OpenIddictServerIntegrationTests .ReturnsAsync(application); mock.Setup(manager => manager.GetPostLogoutRedirectUrisAsync(application, It.IsAny())) - .ReturnsAsync(["http://www.fabrikam.com/path"]); + .ReturnsAsync(ImmutableArray.Create("http://www.fabrikam.com/path")); mock.Setup(manager => manager.HasPermissionAsync(application, Permissions.Endpoints.Logout, It.IsAny())) diff --git a/test/OpenIddict.Server.IntegrationTests/OpenIddictServerIntegrationTests.Userinfo.cs b/test/OpenIddict.Server.IntegrationTests/OpenIddictServerIntegrationTests.Userinfo.cs index 117b1fd3..bf3b7f2a 100644 --- a/test/OpenIddict.Server.IntegrationTests/OpenIddictServerIntegrationTests.Userinfo.cs +++ b/test/OpenIddict.Server.IntegrationTests/OpenIddictServerIntegrationTests.Userinfo.cs @@ -415,7 +415,7 @@ public abstract partial class OpenIddictServerIntegrationTests context.Principal = new ClaimsPrincipal(identity) .SetTokenType(TokenTypeHints.AccessToken) .SetPresenters("Fabrikam") - .SetScopes(ImmutableArray.Create()); + .SetScopes(ImmutableArray.Empty); return default; });