diff --git a/sandbox/OpenIddict.Sandbox.AspNet.Server/Controllers/AuthorizationController.cs b/sandbox/OpenIddict.Sandbox.AspNet.Server/Controllers/AuthorizationController.cs index 9c1bf961..82d81e8d 100644 --- a/sandbox/OpenIddict.Sandbox.AspNet.Server/Controllers/AuthorizationController.cs +++ b/sandbox/OpenIddict.Sandbox.AspNet.Server/Controllers/AuthorizationController.cs @@ -123,7 +123,7 @@ namespace OpenIddict.Sandbox.AspNet.Server.Controllers { // If the consent is external (e.g when authorizations are granted by a sysadmin), // immediately return an error if no authorization can be found in the database. - case ConsentTypes.External when !authorizations.Any(): + case ConsentTypes.External when authorizations.Count is 0: context.Authentication.Challenge( authenticationTypes: OpenIddictServerOwinDefaults.AuthenticationType, properties: new AuthenticationProperties(new Dictionary @@ -138,8 +138,8 @@ namespace OpenIddict.Sandbox.AspNet.Server.Controllers // If the consent is implicit or if an authorization was found, // return an authorization response without displaying the consent form. case ConsentTypes.Implicit: - case ConsentTypes.External when authorizations.Any(): - case ConsentTypes.Explicit when authorizations.Any() && !request.HasPrompt(Prompts.Consent): + case ConsentTypes.External when authorizations.Count is not 0: + case ConsentTypes.Explicit when authorizations.Count is not 0 && !request.HasPrompt(Prompts.Consent): // Create the claims-based identity that will be used by OpenIddict to generate tokens. var identity = new ClaimsIdentity( authenticationType: OpenIddictServerOwinDefaults.AuthenticationType, @@ -245,7 +245,7 @@ namespace OpenIddict.Sandbox.AspNet.Server.Controllers // Note: the same check is already made in the other action but is repeated // here to ensure a malicious user can't abuse this POST-only endpoint and // force it to return a valid response without the external authorization. - if (!authorizations.Any() && await _applicationManager.HasConsentTypeAsync(application, ConsentTypes.External)) + if (authorizations.Count is 0 && await _applicationManager.HasConsentTypeAsync(application, ConsentTypes.External)) { context.Authentication.Challenge( authenticationTypes: OpenIddictServerOwinDefaults.AuthenticationType, diff --git a/sandbox/OpenIddict.Sandbox.AspNetCore.Server/Controllers/AuthorizationController.cs b/sandbox/OpenIddict.Sandbox.AspNetCore.Server/Controllers/AuthorizationController.cs index 6cfa8e55..f483c2a1 100644 --- a/sandbox/OpenIddict.Sandbox.AspNetCore.Server/Controllers/AuthorizationController.cs +++ b/sandbox/OpenIddict.Sandbox.AspNetCore.Server/Controllers/AuthorizationController.cs @@ -159,7 +159,7 @@ public class AuthorizationController : Controller { // If the consent is external (e.g when authorizations are granted by a sysadmin), // immediately return an error if no authorization can be found in the database. - case ConsentTypes.External when !authorizations.Any(): + case ConsentTypes.External when authorizations.Count is 0: return Forbid( authenticationSchemes: OpenIddictServerAspNetCoreDefaults.AuthenticationScheme, properties: new AuthenticationProperties(new Dictionary @@ -172,8 +172,8 @@ public class AuthorizationController : Controller // If the consent is implicit or if an authorization was found, // return an authorization response without displaying the consent form. case ConsentTypes.Implicit: - case ConsentTypes.External when authorizations.Any(): - case ConsentTypes.Explicit when authorizations.Any() && !request.HasPrompt(Prompts.Consent): + case ConsentTypes.External when authorizations.Count is not 0: + case ConsentTypes.Explicit when authorizations.Count is not 0 && !request.HasPrompt(Prompts.Consent): // Create the claims-based identity that will be used by OpenIddict to generate tokens. var identity = new ClaimsIdentity( authenticationType: TokenValidationParameters.DefaultAuthenticationType, @@ -256,7 +256,7 @@ public class AuthorizationController : Controller // Note: the same check is already made in the other action but is repeated // here to ensure a malicious user can't abuse this POST-only endpoint and // force it to return a valid response without the external authorization. - if (!authorizations.Any() && await _applicationManager.HasConsentTypeAsync(application, ConsentTypes.External)) + if (authorizations.Count is 0 && await _applicationManager.HasConsentTypeAsync(application, ConsentTypes.External)) { return Forbid( authenticationSchemes: OpenIddictServerAspNetCoreDefaults.AuthenticationScheme, diff --git a/src/OpenIddict.Client.DataProtection/OpenIddictClientDataProtectionHandlers.cs b/src/OpenIddict.Client.DataProtection/OpenIddictClientDataProtectionHandlers.cs index d4433921..d66d7fd8 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]; + = [.. Protection.DefaultHandlers]; } diff --git a/src/OpenIddict.Client.Owin/OpenIddictClientOwinHandlers.cs b/src/OpenIddict.Client.Owin/OpenIddictClientOwinHandlers.cs index 157b78ad..7f73bf24 100644 --- a/src/OpenIddict.Client.Owin/OpenIddictClientOwinHandlers.cs +++ b/src/OpenIddict.Client.Owin/OpenIddictClientOwinHandlers.cs @@ -66,8 +66,8 @@ public static partial class OpenIddictClientOwinHandlers AttachCacheControlHeader.Descriptor, ProcessLocalErrorResponse.Descriptor, - ..Authentication.DefaultHandlers, - ..Session.DefaultHandlers + .. Authentication.DefaultHandlers, + .. Session.DefaultHandlers ]; /// diff --git a/src/OpenIddict.Client.SystemIntegration/OpenIddictClientSystemIntegrationHandlers.cs b/src/OpenIddict.Client.SystemIntegration/OpenIddictClientSystemIntegrationHandlers.cs index e3e91c15..e72436ec 100644 --- a/src/OpenIddict.Client.SystemIntegration/OpenIddictClientSystemIntegrationHandlers.cs +++ b/src/OpenIddict.Client.SystemIntegration/OpenIddictClientSystemIntegrationHandlers.cs @@ -82,7 +82,7 @@ public static partial class OpenIddictClientSystemIntegrationHandlers */ AbortAuthenticationDemand.Descriptor, - ..Authentication.DefaultHandlers + .. Authentication.DefaultHandlers ]; /// diff --git a/src/OpenIddict.Client.SystemNetHttp/OpenIddictClientSystemNetHttpHandlers.cs b/src/OpenIddict.Client.SystemNetHttp/OpenIddictClientSystemNetHttpHandlers.cs index 849e7bd4..9082cbdf 100644 --- a/src/OpenIddict.Client.SystemNetHttp/OpenIddictClientSystemNetHttpHandlers.cs +++ b/src/OpenIddict.Client.SystemNetHttp/OpenIddictClientSystemNetHttpHandlers.cs @@ -22,12 +22,12 @@ namespace OpenIddict.Client.SystemNetHttp; public static partial class OpenIddictClientSystemNetHttpHandlers { public static ImmutableArray DefaultHandlers { get; } = [ - ..Device.DefaultHandlers, - ..Discovery.DefaultHandlers, - ..Exchange.DefaultHandlers, - ..Introspection.DefaultHandlers, - ..Revocation.DefaultHandlers, - ..Userinfo.DefaultHandlers + .. Device.DefaultHandlers, + .. Discovery.DefaultHandlers, + .. Exchange.DefaultHandlers, + .. Introspection.DefaultHandlers, + .. Revocation.DefaultHandlers, + .. Userinfo.DefaultHandlers ]; /// diff --git a/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.cs b/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.cs index f95e801d..4082cfb8 100644 --- a/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.cs +++ b/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.cs @@ -55,13 +55,13 @@ public static partial class OpenIddictClientWebIntegrationHandlers AttachNonStandardRevocationClientAssertionClaims.Descriptor, AttachRevocationRequestNonStandardClientCredentials.Descriptor, - ..Authentication.DefaultHandlers, - ..Device.DefaultHandlers, - ..Discovery.DefaultHandlers, - ..Exchange.DefaultHandlers, - ..Protection.DefaultHandlers, - ..Revocation.DefaultHandlers, - ..Userinfo.DefaultHandlers + .. Authentication.DefaultHandlers, + .. Device.DefaultHandlers, + .. Discovery.DefaultHandlers, + .. Exchange.DefaultHandlers, + .. Protection.DefaultHandlers, + .. Revocation.DefaultHandlers, + .. Userinfo.DefaultHandlers ]; /// diff --git a/src/OpenIddict.Core/Managers/OpenIddictApplicationManager.cs b/src/OpenIddict.Core/Managers/OpenIddictApplicationManager.cs index 1e293d1d..7b978913 100644 --- a/src/OpenIddict.Core/Managers/OpenIddictApplicationManager.cs +++ b/src/OpenIddict.Core/Managers/OpenIddictApplicationManager.cs @@ -1025,9 +1025,9 @@ 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)], 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)], cancellationToken); await Store.SetRequirementsAsync(application, descriptor.Requirements.ToImmutableArray(), cancellationToken); await Store.SetSettingsAsync(application, descriptor.Settings.ToImmutableDictionary(), cancellationToken); } diff --git a/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.cs b/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.cs index 1a095769..5ddd28dd 100644 --- a/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.cs +++ b/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.cs @@ -52,14 +52,14 @@ public static partial class OpenIddictServerAspNetCoreHandlers */ ResolveHostSignOutProperties.Descriptor, - ..Authentication.DefaultHandlers, - ..Device.DefaultHandlers, - ..Discovery.DefaultHandlers, - ..Exchange.DefaultHandlers, - ..Introspection.DefaultHandlers, - ..Revocation.DefaultHandlers, - ..Session.DefaultHandlers, - ..Userinfo.DefaultHandlers + .. Authentication.DefaultHandlers, + .. Device.DefaultHandlers, + .. Discovery.DefaultHandlers, + .. Exchange.DefaultHandlers, + .. Introspection.DefaultHandlers, + .. Revocation.DefaultHandlers, + .. Session.DefaultHandlers, + .. Userinfo.DefaultHandlers ]; /// diff --git a/src/OpenIddict.Server.DataProtection/OpenIddictServerDataProtectionHandlers.cs b/src/OpenIddict.Server.DataProtection/OpenIddictServerDataProtectionHandlers.cs index 08c5066d..a2827c7e 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]; + = [.. Protection.DefaultHandlers]; } diff --git a/src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.cs b/src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.cs index 1272be42..6aa2e1a4 100644 --- a/src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.cs +++ b/src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.cs @@ -47,14 +47,14 @@ public static partial class OpenIddictServerOwinHandlers */ ResolveHostSignOutProperties.Descriptor, - ..Authentication.DefaultHandlers, - ..Device.DefaultHandlers, - ..Discovery.DefaultHandlers, - ..Exchange.DefaultHandlers, - ..Introspection.DefaultHandlers, - ..Revocation.DefaultHandlers, - ..Session.DefaultHandlers, - ..Userinfo.DefaultHandlers + .. Authentication.DefaultHandlers, + .. Device.DefaultHandlers, + .. Discovery.DefaultHandlers, + .. Exchange.DefaultHandlers, + .. Introspection.DefaultHandlers, + .. Revocation.DefaultHandlers, + .. Session.DefaultHandlers, + .. Userinfo.DefaultHandlers ]; /// diff --git a/src/OpenIddict.Server/OpenIddictServerHandlers.cs b/src/OpenIddict.Server/OpenIddictServerHandlers.cs index e9f092ba..2a924c72 100644 --- a/src/OpenIddict.Server/OpenIddictServerHandlers.cs +++ b/src/OpenIddict.Server/OpenIddictServerHandlers.cs @@ -107,15 +107,15 @@ public static partial class OpenIddictServerHandlers AttachErrorParameters.Descriptor, AttachCustomErrorParameters.Descriptor, - ..Authentication.DefaultHandlers, - ..Device.DefaultHandlers, - ..Discovery.DefaultHandlers, - ..Exchange.DefaultHandlers, - ..Introspection.DefaultHandlers, - ..Protection.DefaultHandlers, - ..Revocation.DefaultHandlers, - ..Session.DefaultHandlers, - ..Userinfo.DefaultHandlers + .. Authentication.DefaultHandlers, + .. Device.DefaultHandlers, + .. Discovery.DefaultHandlers, + .. Exchange.DefaultHandlers, + .. Introspection.DefaultHandlers, + .. Protection.DefaultHandlers, + .. Revocation.DefaultHandlers, + .. Session.DefaultHandlers, + .. Userinfo.DefaultHandlers ]; /// diff --git a/src/OpenIddict.Validation.DataProtection/OpenIddictValidationDataProtectionHandlers.cs b/src/OpenIddict.Validation.DataProtection/OpenIddictValidationDataProtectionHandlers.cs index 2b7a38c3..50e97d70 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]; + = [.. Protection.DefaultHandlers]; } diff --git a/src/OpenIddict.Validation.SystemNetHttp/OpenIddictValidationSystemNetHttpHandlers.cs b/src/OpenIddict.Validation.SystemNetHttp/OpenIddictValidationSystemNetHttpHandlers.cs index 5d63f299..2e3e542a 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]; + = [.. Discovery.DefaultHandlers, .. Introspection.DefaultHandlers]; /// /// Contains the logic responsible for creating and attaching a . diff --git a/src/OpenIddict.Validation/OpenIddictValidationHandlers.cs b/src/OpenIddict.Validation/OpenIddictValidationHandlers.cs index 40677ec3..7726e7f3 100644 --- a/src/OpenIddict.Validation/OpenIddictValidationHandlers.cs +++ b/src/OpenIddict.Validation/OpenIddictValidationHandlers.cs @@ -49,9 +49,9 @@ public static partial class OpenIddictValidationHandlers AttachErrorParameters.Descriptor, AttachCustomErrorParameters.Descriptor, - ..Discovery.DefaultHandlers, - ..Introspection.DefaultHandlers, - ..Protection.DefaultHandlers + .. Discovery.DefaultHandlers, + .. Introspection.DefaultHandlers, + .. Protection.DefaultHandlers ]; ///