diff --git a/Directory.Build.props b/Directory.Build.props
index 9c64dd01..73b144ca 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -93,6 +93,10 @@
false
+
+ true
+
+
true
@@ -102,4 +106,8 @@
+
+
+
+
diff --git a/gen/OpenIddict.Client.WebIntegration.Generators/OpenIddictClientWebIntegrationGenerator.cs b/gen/OpenIddict.Client.WebIntegration.Generators/OpenIddictClientWebIntegrationGenerator.cs
index 8264ef9d..a5e4f1b3 100644
--- a/gen/OpenIddict.Client.WebIntegration.Generators/OpenIddictClientWebIntegrationGenerator.cs
+++ b/gen/OpenIddict.Client.WebIntegration.Generators/OpenIddictClientWebIntegrationGenerator.cs
@@ -1038,7 +1038,7 @@ public sealed partial class OpenIddictClientWebIntegrationConfiguration
{
{ Count: > 0 } methods => methods.Select(type => (string?) type.Attribute("Value")).ToList(),
- _ => (IList) Array.Empty()
+ _ => []
},
GrantTypesSupported = configuration.Elements("GrantType").ToList() switch
@@ -1046,7 +1046,7 @@ public sealed partial class OpenIddictClientWebIntegrationConfiguration
{ Count: > 0 } types => types.Select(type => (string?) type.Attribute("Value")).ToList(),
// If no explicit grant type was set, assume the provider only supports the code flow.
- _ => (IList) new[] { GrantTypes.AuthorizationCode }
+ _ => [GrantTypes.AuthorizationCode]
},
ResponseModesSupported = configuration.Elements("ResponseMode").ToList() switch
@@ -1054,7 +1054,7 @@ public sealed partial class OpenIddictClientWebIntegrationConfiguration
{ Count: > 0 } modes => modes.Select(type => (string?) type.Attribute("Value")).ToList(),
// If no explicit response mode was set, assume the provider only supports the query response mode.
- _ => (IList) new[] { ResponseModes.Query }
+ _ => [ResponseModes.Query]
},
ResponseTypesSupported = configuration.Elements("ResponseType").ToList() switch
@@ -1062,14 +1062,14 @@ public sealed partial class OpenIddictClientWebIntegrationConfiguration
{ Count: > 0 } types => types.Select(type => (string?) type.Attribute("Value")).ToList(),
// If no explicit response type was set, assume the provider only supports the code flow.
- _ => (IList) new[] { ResponseTypes.Code }
+ _ => [ResponseTypes.Code]
},
ScopesSupported = configuration.Elements("Scope").ToList() switch
{
{ Count: > 0 } types => types.Select(type => (string?) type.Attribute("Value")).ToList(),
- _ => (IList) Array.Empty()
+ _ => []
},
DeviceAuthorizationEndpointAuthMethodsSupported = configuration.Elements("DeviceAuthorizationEndpointAuthMethodsSupported").ToList() switch
@@ -1078,7 +1078,7 @@ public sealed partial class OpenIddictClientWebIntegrationConfiguration
// If no explicit client authentication method was set, assume the provider only supports
// flowing the client credentials as part of the device authorization request payload.
- _ => (IList) new[] { ClientAuthenticationMethods.ClientSecretPost }
+ _ => [ClientAuthenticationMethods.ClientSecretPost]
},
TokenEndpointAuthMethodsSupported = configuration.Elements("TokenEndpointAuthMethod").ToList() switch
@@ -1087,7 +1087,7 @@ public sealed partial class OpenIddictClientWebIntegrationConfiguration
// If no explicit client authentication method was set, assume the provider only
// supports flowing the client credentials as part of the token request payload.
- _ => (IList) new[] { ClientAuthenticationMethods.ClientSecretPost }
+ _ => [ClientAuthenticationMethods.ClientSecretPost]
}
},
diff --git a/shared/OpenIddict.Extensions/OpenIddict.Extensions.csproj b/shared/OpenIddict.Extensions/OpenIddict.Extensions.csproj
index 76e6baf4..13981f23 100644
--- a/shared/OpenIddict.Extensions/OpenIddict.Extensions.csproj
+++ b/shared/OpenIddict.Extensions/OpenIddict.Extensions.csproj
@@ -9,6 +9,11 @@
+
+
+
+
diff --git a/shared/OpenIddict.Extensions/Helpers/OpenIddictHelpers.cs b/shared/OpenIddict.Extensions/OpenIddictHelpers.cs
similarity index 99%
rename from shared/OpenIddict.Extensions/Helpers/OpenIddictHelpers.cs
rename to shared/OpenIddict.Extensions/OpenIddictHelpers.cs
index f340b18c..26118989 100644
--- a/shared/OpenIddict.Extensions/Helpers/OpenIddictHelpers.cs
+++ b/shared/OpenIddict.Extensions/OpenIddictHelpers.cs
@@ -3,11 +3,9 @@ using System.Data;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
-using System.Security.Claims;
using System.Security.Cryptography;
using System.Text;
using Microsoft.Extensions.Primitives;
-using Microsoft.IdentityModel.Tokens;
namespace OpenIddict.Extensions;
@@ -527,7 +525,7 @@ internal static class OpenIddictHelpers
///
public static byte[] ComputeSha256MessageAuthenticationCode(byte[] key, byte[] data)
{
- var algorithm = CryptoConfig.CreateFromName("OpenIddict HMAC SHA-256 Cryptographic Provider", new[] { key }) switch
+ var algorithm = CryptoConfig.CreateFromName("OpenIddict HMAC SHA-256 Cryptographic Provider", [key]) switch
{
HMACSHA256 result => result,
null => null,
@@ -894,7 +892,7 @@ internal static class OpenIddictHelpers
// Warning: the type and order of the arguments specified here MUST exactly match the parameters used with
// Rfc2898DeriveBytes(string password, byte[] salt, int iterations, HashAlgorithmName hashAlgorithm).
using var generator = CryptoConfig.CreateFromName("OpenIddict PBKDF2 Cryptographic Provider",
- args: new object?[] { secret, salt, iterations, algorithm }) switch
+ args: [secret, salt, iterations, algorithm]) switch
{
Rfc2898DeriveBytes result => result,
diff --git a/shared/OpenIddict.Extensions/OpenIddictPolyfills.cs b/shared/OpenIddict.Extensions/OpenIddictPolyfills.cs
new file mode 100644
index 00000000..de45b9b6
--- /dev/null
+++ b/shared/OpenIddict.Extensions/OpenIddictPolyfills.cs
@@ -0,0 +1,11 @@
+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/Descriptors/OpenIddictApplicationDescriptor.cs b/src/OpenIddict.Abstractions/Descriptors/OpenIddictApplicationDescriptor.cs
index d06ea0e5..196296f8 100644
--- a/src/OpenIddict.Abstractions/Descriptors/OpenIddictApplicationDescriptor.cs
+++ b/src/OpenIddict.Abstractions/Descriptors/OpenIddictApplicationDescriptor.cs
@@ -45,7 +45,7 @@ public class OpenIddictApplicationDescriptor
///
/// Gets the localized display names associated with the application.
///
- public Dictionary DisplayNames { get; } = new();
+ public Dictionary DisplayNames { get; } = [];
///
/// Gets or sets the JSON Web Key Set associated with the application.
@@ -60,7 +60,7 @@ public class OpenIddictApplicationDescriptor
///
/// Gets the post-logout redirect URIs associated with the application.
///
- public HashSet PostLogoutRedirectUris { get; } = new();
+ public HashSet PostLogoutRedirectUris { get; } = [];
///
/// Gets the additional properties associated with the application.
@@ -70,7 +70,7 @@ public class OpenIddictApplicationDescriptor
///
/// Gets the redirect URIs associated with the application.
///
- public HashSet RedirectUris { get; } = new();
+ public HashSet RedirectUris { get; } = [];
///
/// Gets the requirements associated with the application.
diff --git a/src/OpenIddict.Abstractions/Descriptors/OpenIddictScopeDescriptor.cs b/src/OpenIddict.Abstractions/Descriptors/OpenIddictScopeDescriptor.cs
index dd56f391..ee7d2a2c 100644
--- a/src/OpenIddict.Abstractions/Descriptors/OpenIddictScopeDescriptor.cs
+++ b/src/OpenIddict.Abstractions/Descriptors/OpenIddictScopeDescriptor.cs
@@ -16,7 +16,7 @@ public class OpenIddictScopeDescriptor
///
/// Gets the localized descriptions associated with the scope.
///
- public Dictionary Descriptions { get; } = new();
+ public Dictionary Descriptions { get; } = [];
///
/// Gets or sets the display name associated with the scope.
@@ -26,7 +26,7 @@ public class OpenIddictScopeDescriptor
///
/// Gets the localized display names associated with the scope.
///
- public Dictionary DisplayNames { get; } = new();
+ public Dictionary DisplayNames { get; } = [];
///
/// Gets or sets the unique name associated with the scope.
diff --git a/src/OpenIddict.Abstractions/OpenIddictConstants.cs b/src/OpenIddict.Abstractions/OpenIddictConstants.cs
index a3948036..04a2e808 100644
--- a/src/OpenIddict.Abstractions/OpenIddictConstants.cs
+++ b/src/OpenIddict.Abstractions/OpenIddictConstants.cs
@@ -477,16 +477,16 @@ public static class OpenIddictConstants
public static class Separators
{
- public static readonly char[] Ampersand = { '&' };
- public static readonly char[] Comma = { ',' };
- public static readonly char[] Dash = { '-' };
- public static readonly char[] Dot = { '.' };
- public static readonly char[] DoubleQuote = { '"' };
- public static readonly char[] EqualsSign = { '=' };
- public static readonly char[] Hash = { '#' };
- public static readonly char[] QuestionMark = { '?' };
- public static readonly char[] Semicolon = { ';' };
- public static readonly char[] Space = { ' ' };
+ public static readonly char[] Ampersand = ['&'];
+ public static readonly char[] Comma = [','];
+ public static readonly char[] Dash = ['-'];
+ public static readonly char[] Dot = ['.'];
+ public static readonly char[] DoubleQuote = ['"'];
+ public static readonly char[] EqualsSign = ['='];
+ public static readonly char[] Hash = ['#'];
+ public static readonly char[] QuestionMark = ['?'];
+ public static readonly char[] Semicolon = [';'];
+ public static readonly char[] Space = [' '];
}
public static class Settings
diff --git a/src/OpenIddict.Abstractions/OpenIddictExceptions.cs b/src/OpenIddict.Abstractions/OpenIddictExceptions.cs
index 7b0410e2..6e65c16b 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, ImmutableArray.Create())
+ : this(message, [])
{
}
diff --git a/src/OpenIddict.Abstractions/Primitives/OpenIddictConfiguration.cs b/src/OpenIddict.Abstractions/Primitives/OpenIddictConfiguration.cs
index fe8f69af..340e6317 100644
--- a/src/OpenIddict.Abstractions/Primitives/OpenIddictConfiguration.cs
+++ b/src/OpenIddict.Abstractions/Primitives/OpenIddictConfiguration.cs
@@ -99,7 +99,7 @@ public sealed class OpenIddictConfiguration
///
/// Gets the signing keys extracted from the JSON Web Key set.
///
- public List SigningKeys { get; } = new();
+ public List SigningKeys { get; } = [];
///
/// Gets or sets the URI of the token endpoint.
diff --git a/src/OpenIddict.Abstractions/Primitives/OpenIddictExtensions.cs b/src/OpenIddict.Abstractions/Primitives/OpenIddictExtensions.cs
index b52f3d2c..31f90040 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 ImmutableArray.Create();
+ return [];
}
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() ?? ImmutableArray.Create());
+ => claim.SetDestinations(destinations?.ToImmutableArray() ?? []);
///
/// 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() ?? ImmutableArray.Create());
+ => claim.SetDestinations(destinations?.ToImmutableArray() ?? []);
///
/// Gets the destinations associated with all the claims of the given identity.
@@ -2810,7 +2810,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() ?? ImmutableArray.Create());
+ => identity.SetAudiences(audiences?.ToImmutableArray() ?? []);
///
/// Sets the audiences list in the claims principal.
@@ -2820,7 +2820,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() ?? ImmutableArray.Create());
+ => principal.SetAudiences(audiences?.ToImmutableArray() ?? []);
///
/// Sets the audiences list in the claims identity.
@@ -2830,7 +2830,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() ?? ImmutableArray.Create());
+ => identity.SetAudiences(audiences?.ToImmutableArray() ?? []);
///
/// Sets the audiences list in the claims principal.
@@ -2840,7 +2840,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() ?? ImmutableArray.Create());
+ => principal.SetAudiences(audiences?.ToImmutableArray() ?? []);
///
/// Sets the presenters list in the claims identity.
@@ -2870,7 +2870,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() ?? ImmutableArray.Create());
+ => identity.SetPresenters(presenters?.ToImmutableArray() ?? []);
///
/// Sets the presenters list in the claims principal.
@@ -2880,7 +2880,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() ?? ImmutableArray.Create());
+ => principal.SetPresenters(presenters?.ToImmutableArray() ?? []);
///
/// Sets the presenters list in the claims identity.
@@ -2890,7 +2890,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() ?? ImmutableArray.Create());
+ => identity.SetPresenters(presenters?.ToImmutableArray() ?? []);
///
/// Sets the presenters list in the claims principal.
@@ -2900,7 +2900,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() ?? ImmutableArray.Create());
+ => principal.SetPresenters(presenters?.ToImmutableArray() ?? []);
///
/// Sets the resources list in the claims identity.
@@ -2930,7 +2930,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() ?? ImmutableArray.Create());
+ => identity.SetResources(resources?.ToImmutableArray() ?? []);
///
/// Sets the resources list in the claims principal.
@@ -2940,7 +2940,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() ?? ImmutableArray.Create());
+ => principal.SetResources(resources?.ToImmutableArray() ?? []);
///
/// Sets the resources list in the claims identity.
@@ -2950,7 +2950,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() ?? ImmutableArray.Create());
+ => identity.SetResources(resources?.ToImmutableArray() ?? []);
///
/// Sets the resources list in the claims principal.
@@ -2960,7 +2960,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() ?? ImmutableArray.Create());
+ => principal.SetResources(resources?.ToImmutableArray() ?? []);
///
/// Sets the scopes list in the claims identity.
@@ -2990,7 +2990,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() ?? ImmutableArray.Create());
+ => identity.SetScopes(scopes?.ToImmutableArray() ?? []);
///
/// Sets the scopes list in the claims principal.
@@ -3000,7 +3000,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() ?? ImmutableArray.Create());
+ => principal.SetScopes(scopes?.ToImmutableArray() ?? []);
///
/// Sets the scopes list in the claims identity.
@@ -3010,7 +3010,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() ?? ImmutableArray.Create());
+ => identity.SetScopes(scopes?.ToImmutableArray() ?? []);
///
/// Sets the scopes list in the claims principal.
@@ -3020,7 +3020,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() ?? ImmutableArray.Create());
+ => principal.SetScopes(scopes?.ToImmutableArray() ?? []);
///
/// Sets the access token lifetime associated with the claims identity.
@@ -3208,7 +3208,7 @@ public static class OpenIddictExtensions
if (string.IsNullOrEmpty(source))
{
- return ImmutableArray.Create();
+ return [];
}
var builder = ImmutableArray.CreateBuilder();
diff --git a/src/OpenIddict.Abstractions/Primitives/OpenIddictParameter.cs b/src/OpenIddict.Abstractions/Primitives/OpenIddictParameter.cs
index d8da9035..8ab1c6fa 100644
--- a/src/OpenIddict.Abstractions/Primitives/OpenIddictParameter.cs
+++ b/src/OpenIddict.Abstractions/Primitives/OpenIddictParameter.cs
@@ -1119,13 +1119,13 @@ public readonly struct OpenIddictParameter : IEquatable
string?[] value => value,
// When the parameter is a string value, return an array with a single entry.
- string value => new string?[] { value },
+ string value => [value],
// When the parameter is a boolean value, return an array with its string representation.
- bool value => new string?[] { value ? bool.TrueString : bool.FalseString },
+ bool value => [value ? bool.TrueString : bool.FalseString],
// When the parameter is an integer, return an array with its string representation.
- long value => new string?[] { value.ToString(CultureInfo.InvariantCulture) },
+ long value => [value.ToString(CultureInfo.InvariantCulture)],
// When the parameter is a JsonElement, try to convert it if it's of a supported type.
JsonElement value => ConvertFromJsonElement(value),
@@ -1136,18 +1136,18 @@ public readonly struct OpenIddictParameter : IEquatable
JsonValue value when value.TryGetValue(out JsonElement element) => ConvertFromJsonElement(element),
// When the parameter is a JsonValue wrapping a string, return an array with a single entry.
- JsonValue value when value.TryGetValue(out string? result) => new string?[] { result },
+ JsonValue value when value.TryGetValue(out string? result) => [result],
// When the parameter is a JsonValue wrapping a boolean, return an array with its string representation.
JsonValue value when value.TryGetValue(out bool result)
- => new string?[] { result ? bool.TrueString : bool.FalseString },
+ => [result ? bool.TrueString : bool.FalseString],
// When the parameter is a JsonValue wrapping an integer, return an array with its string representation.
JsonValue value when value.TryGetValue(out int result)
- => new string?[] { result.ToString(CultureInfo.InvariantCulture) },
+ => [result.ToString(CultureInfo.InvariantCulture)],
JsonValue value when value.TryGetValue(out long result)
- => new string?[] { result.ToString(CultureInfo.InvariantCulture) },
+ => [result.ToString(CultureInfo.InvariantCulture)],
// When the parameter is a JsonNode (e.g a JsonValue wrapping a non-primitive type),
// serialize it to a JsonElement first to determine its actual JSON representation
@@ -1165,7 +1165,7 @@ public readonly struct OpenIddictParameter : IEquatable
// or a boolean, return an 1-item array with its string representation.
JsonValueKind.String or JsonValueKind.Number or
JsonValueKind.True or JsonValueKind.False
- => new string?[] { element.ToString() },
+ => [element.ToString()],
// When the parameter is a JsonElement representing an array, return the elements as strings.
JsonValueKind.Array => CreateArrayFromJsonElement(element),
diff --git a/src/OpenIddict.AspNetCore/OpenIddict.AspNetCore.csproj b/src/OpenIddict.AspNetCore/OpenIddict.AspNetCore.csproj
index 90fb23d0..93afebc0 100644
--- a/src/OpenIddict.AspNetCore/OpenIddict.AspNetCore.csproj
+++ b/src/OpenIddict.AspNetCore/OpenIddict.AspNetCore.csproj
@@ -4,6 +4,7 @@
$(NetFrameworkTargetFrameworks);$(NetCoreTargetFrameworks)
false
false
+ false
diff --git a/src/OpenIddict.Client.AspNetCore/OpenIddict.Client.AspNetCore.csproj b/src/OpenIddict.Client.AspNetCore/OpenIddict.Client.AspNetCore.csproj
index 467041e0..fba06f9e 100644
--- a/src/OpenIddict.Client.AspNetCore/OpenIddict.Client.AspNetCore.csproj
+++ b/src/OpenIddict.Client.AspNetCore/OpenIddict.Client.AspNetCore.csproj
@@ -27,10 +27,6 @@
-
-
-
-
diff --git a/src/OpenIddict.Client.AspNetCore/OpenIddictClientAspNetCoreHandlers.Authentication.cs b/src/OpenIddict.Client.AspNetCore/OpenIddictClientAspNetCoreHandlers.Authentication.cs
index 350cd77e..1bb5b81c 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; } = ImmutableArray.Create(
+ public static ImmutableArray DefaultHandlers { get; } = [
/*
* Authorization request processing:
*/
@@ -37,7 +37,8 @@ public static partial class OpenIddictClientAspNetCoreHandlers
AttachCacheControlHeader.Descriptor,
ProcessPassthroughErrorResponse.Descriptor,
ProcessStatusCodePagesErrorResponse.Descriptor,
- ProcessLocalErrorResponse.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 fad91386..6cdbb244 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; } = ImmutableArray.Create(
+ public static ImmutableArray DefaultHandlers { get; } = [
/*
* Session request processing:
*/
@@ -37,7 +37,8 @@ public static partial class OpenIddictClientAspNetCoreHandlers
AttachCacheControlHeader.Descriptor,
ProcessPassthroughErrorResponse.Descriptor,
ProcessStatusCodePagesErrorResponse.Descriptor,
- ProcessLocalErrorResponse.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 bf237964..fb8f1b2c 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; } = ImmutableArray.Create(
+ public static ImmutableArray DefaultHandlers { get; } = [
/*
* Top-level request processing:
*/
@@ -70,9 +70,11 @@ public static partial class OpenIddictClientAspNetCoreHandlers
AttachHttpResponseCode.Descriptor,
AttachCacheControlHeader.Descriptor,
ProcessStatusCodePagesErrorResponse.Descriptor,
- ProcessLocalErrorResponse.Descriptor)
- .AddRange(Authentication.DefaultHandlers)
- .AddRange(Session.DefaultHandlers);
+ ProcessLocalErrorResponse.Descriptor,
+
+ ..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.AspNetCore/OpenIddictClientAspNetCoreOptions.cs b/src/OpenIddict.Client.AspNetCore/OpenIddictClientAspNetCoreOptions.cs
index d080556c..e4afdcd6 100644
--- a/src/OpenIddict.Client.AspNetCore/OpenIddictClientAspNetCoreOptions.cs
+++ b/src/OpenIddict.Client.AspNetCore/OpenIddictClientAspNetCoreOptions.cs
@@ -26,7 +26,7 @@ public sealed class OpenIddictClientAspNetCoreOptions : AuthenticationSchemeOpti
///
/// Gets the forwarded authentication schemes that are managed by the OpenIddict ASP.NET Core client host.
///
- public List ForwardedAuthenticationSchemes { get; } = new();
+ public List ForwardedAuthenticationSchemes { get; } = [];
///
/// Gets or sets a boolean indicating whether incoming requests arriving on insecure endpoints should be
diff --git a/src/OpenIddict.Client.DataProtection/OpenIddict.Client.DataProtection.csproj b/src/OpenIddict.Client.DataProtection/OpenIddict.Client.DataProtection.csproj
index 28e98d50..992dcebb 100644
--- a/src/OpenIddict.Client.DataProtection/OpenIddict.Client.DataProtection.csproj
+++ b/src/OpenIddict.Client.DataProtection/OpenIddict.Client.DataProtection.csproj
@@ -29,10 +29,6 @@
-
-
-
-
diff --git a/src/OpenIddict.Client.DataProtection/OpenIddictClientDataProtectionHandlers.Protection.cs b/src/OpenIddict.Client.DataProtection/OpenIddictClientDataProtectionHandlers.Protection.cs
index 6e5912b9..69f0433b 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; } = ImmutableArray.Create(
+ public static ImmutableArray DefaultHandlers { get; } = [
/*
* Token validation:
*/
@@ -31,7 +31,8 @@ public static partial class OpenIddictClientDataProtectionHandlers
* Token generation:
*/
OverrideGeneratedTokenFormat.Descriptor,
- GenerateDataProtectionToken.Descriptor);
+ GenerateDataProtectionToken.Descriptor
+ ];
///
/// Contains the logic responsible for validating tokens generated using Data Protection.
@@ -124,9 +125,9 @@ public static partial class OpenIddictClientDataProtectionHandlers
(type, context.IsReferenceToken) switch
{
(TokenTypeHints.StateToken, true)
- => new[] { Handlers.Client, Formats.StateToken, Features.ReferenceTokens, Schemes.Server },
+ => [Handlers.Client, Formats.StateToken, Features.ReferenceTokens, Schemes.Server],
(TokenTypeHints.StateToken, false)
- => new[] { Handlers.Client, Formats.StateToken, Schemes.Server },
+ => [Handlers.Client, Formats.StateToken, Schemes.Server],
_ => throw new InvalidOperationException(SR.GetResourceString(SR.ID0003))
});
@@ -240,9 +241,9 @@ public static partial class OpenIddictClientDataProtectionHandlers
(context.TokenType, context.IsReferenceToken) switch
{
(TokenTypeHints.StateToken, true)
- => new[] { Handlers.Client, Formats.StateToken, Features.ReferenceTokens, Schemes.Server },
+ => [Handlers.Client, Formats.StateToken, Features.ReferenceTokens, Schemes.Server],
(TokenTypeHints.StateToken, false)
- => new[] { Handlers.Client, Formats.StateToken, Schemes.Server },
+ => [Handlers.Client, Formats.StateToken, Schemes.Server],
_ => throw new InvalidOperationException(SR.GetResourceString(SR.ID0003))
});
diff --git a/src/OpenIddict.Client.DataProtection/OpenIddictClientDataProtectionHandlers.cs b/src/OpenIddict.Client.DataProtection/OpenIddictClientDataProtectionHandlers.cs
index 1d0c3341..d4433921 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; }
- = ImmutableArray.CreateRange(Protection.DefaultHandlers);
+ = [..Protection.DefaultHandlers];
}
diff --git a/src/OpenIddict.Client.Owin/OpenIddict.Client.Owin.csproj b/src/OpenIddict.Client.Owin/OpenIddict.Client.Owin.csproj
index 217c7a1c..b05d3a81 100644
--- a/src/OpenIddict.Client.Owin/OpenIddict.Client.Owin.csproj
+++ b/src/OpenIddict.Client.Owin/OpenIddict.Client.Owin.csproj
@@ -19,10 +19,6 @@
-
-
-
-
diff --git a/src/OpenIddict.Client.Owin/OpenIddictClientOwinHandler.cs b/src/OpenIddict.Client.Owin/OpenIddictClientOwinHandler.cs
index d2e304c6..b6c3e1d0 100644
--- a/src/OpenIddict.Client.Owin/OpenIddictClientOwinHandler.cs
+++ b/src/OpenIddict.Client.Owin/OpenIddictClientOwinHandler.cs
@@ -399,7 +399,7 @@ public sealed class OpenIddictClientOwinHandler : AuthenticationHandler(
Context.Authentication.AuthenticationResponseChallenge.Properties.Dictionary ??
ImmutableDictionary.Create())
@@ -437,7 +437,7 @@ public sealed class OpenIddictClientOwinHandler : AuthenticationHandler(
Context.Authentication.AuthenticationResponseRevoke.Properties.Dictionary ??
ImmutableDictionary.Create())
diff --git a/src/OpenIddict.Client.Owin/OpenIddictClientOwinHandlers.Authentication.cs b/src/OpenIddict.Client.Owin/OpenIddictClientOwinHandlers.Authentication.cs
index a4549e0c..69f71e36 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; } = ImmutableArray.Create(
+ public static ImmutableArray DefaultHandlers { get; } = [
/*
* Authorization request processing:
*/
@@ -37,7 +37,8 @@ public static partial class OpenIddictClientOwinHandlers
SuppressFormsAuthenticationRedirect.Descriptor,
AttachCacheControlHeader.Descriptor,
ProcessPassthroughErrorResponse.Descriptor,
- ProcessLocalErrorResponse.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 f9bbc900..0c589b9b 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; } = ImmutableArray.Create(
+ public static ImmutableArray DefaultHandlers { get; } = [
/*
* Session request processing:
*/
@@ -35,7 +35,8 @@ public static partial class OpenIddictClientOwinHandlers
AttachHttpResponseCode.Descriptor,
AttachCacheControlHeader.Descriptor,
ProcessPassthroughErrorResponse.Descriptor,
- ProcessLocalErrorResponse.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 8e930558..25468c7e 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; } = ImmutableArray.Create(
+ public static ImmutableArray DefaultHandlers { get; } = [
/*
* Top-level request processing:
*/
@@ -64,9 +64,11 @@ public static partial class OpenIddictClientOwinHandlers
// Errors returned by an OpenIddict endpoint are handled via the Apply*Response events.
AttachHttpResponseCode.Descriptor,
AttachCacheControlHeader.Descriptor,
- ProcessLocalErrorResponse.Descriptor)
- .AddRange(Authentication.DefaultHandlers)
- .AddRange(Session.DefaultHandlers);
+ ProcessLocalErrorResponse.Descriptor,
+
+ ..Authentication.DefaultHandlers,
+ ..Session.DefaultHandlers
+ ];
///
/// Contains the logic responsible for resolving the request URI from the OWIN environment.
@@ -1197,7 +1199,7 @@ public static partial class OpenIddictClientOwinHandlers
response.Context.Authentication.AuthenticationResponseChallenge is null)
{
response.Context.Authentication.AuthenticationResponseChallenge =
- new AuthenticationResponseChallenge(new[] { Guid.NewGuid().ToString() }, null);
+ new AuthenticationResponseChallenge([Guid.NewGuid().ToString()], null);
}
return default;
diff --git a/src/OpenIddict.Client.Owin/OpenIddictClientOwinOptions.cs b/src/OpenIddict.Client.Owin/OpenIddictClientOwinOptions.cs
index e314b442..d1375e61 100644
--- a/src/OpenIddict.Client.Owin/OpenIddictClientOwinOptions.cs
+++ b/src/OpenIddict.Client.Owin/OpenIddictClientOwinOptions.cs
@@ -33,7 +33,7 @@ public sealed class OpenIddictClientOwinOptions : AuthenticationOptions
///
/// Gets the forwarded authentication types that are managed by the OpenIddict OWIN client host.
///
- public List ForwardedAuthenticationTypes { get; } = new();
+ public List ForwardedAuthenticationTypes { get; } = [];
///
/// Gets or sets a boolean indicating whether incoming requests arriving on insecure endpoints should be
diff --git a/src/OpenIddict.Client.SystemIntegration/OpenIddict.Client.SystemIntegration.csproj b/src/OpenIddict.Client.SystemIntegration/OpenIddict.Client.SystemIntegration.csproj
index 64613a88..107577e9 100644
--- a/src/OpenIddict.Client.SystemIntegration/OpenIddict.Client.SystemIntegration.csproj
+++ b/src/OpenIddict.Client.SystemIntegration/OpenIddict.Client.SystemIntegration.csproj
@@ -37,10 +37,6 @@
-
-
-
-
diff --git a/src/OpenIddict.Client.SystemIntegration/OpenIddictClientSystemIntegrationHandlers.Authentication.cs b/src/OpenIddict.Client.SystemIntegration/OpenIddictClientSystemIntegrationHandlers.Authentication.cs
index d7461b35..9a0be002 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; } = ImmutableArray.Create(
+ public static ImmutableArray DefaultHandlers { get; } = [
/*
* Authorization request processing:
*/
@@ -44,7 +44,8 @@ public static partial class OpenIddictClientSystemIntegrationHandlers
AttachCacheControlHeader.Descriptor,
ProcessEmptyHttpResponse.Descriptor,
ProcessProtocolActivationResponse.Descriptor,
- ProcessWebAuthenticationResultResponse.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 f4d97ff9..a70e3e93 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; } = ImmutableArray.Create(
+ public static ImmutableArray DefaultHandlers { get; } = [
/*
* Top-level request processing:
*/
@@ -79,8 +79,10 @@ public static partial class OpenIddictClientSystemIntegrationHandlers
/*
* Error processing:
*/
- AbortAuthenticationDemand.Descriptor)
- .AddRange(Authentication.DefaultHandlers);
+ AbortAuthenticationDemand.Descriptor,
+
+ ..Authentication.DefaultHandlers
+ ];
///
/// Contains the logic responsible for resolving the request URI from the HTTP listener request.
diff --git a/src/OpenIddict.Client.SystemIntegration/OpenIddictClientSystemIntegrationOptions.cs b/src/OpenIddict.Client.SystemIntegration/OpenIddictClientSystemIntegrationOptions.cs
index 24211293..26462ef5 100644
--- a/src/OpenIddict.Client.SystemIntegration/OpenIddictClientSystemIntegrationOptions.cs
+++ b/src/OpenIddict.Client.SystemIntegration/OpenIddictClientSystemIntegrationOptions.cs
@@ -37,7 +37,7 @@ public sealed class OpenIddictClientSystemIntegrationOptions
/// If this property is not explicitly set, a port in the 49152-65535
/// dynamic ports range is automatically chosen by OpenIddict at runtime.
///
- public List AllowedEmbeddedWebServerPorts { get; } = new();
+ public List AllowedEmbeddedWebServerPorts { get; } = [];
///
/// Gets or sets a boolean indicating whether protocol activation processing should be enabled.
diff --git a/src/OpenIddict.Client.SystemNetHttp/OpenIddict.Client.SystemNetHttp.csproj b/src/OpenIddict.Client.SystemNetHttp/OpenIddict.Client.SystemNetHttp.csproj
index 7c80b408..8bbc5c0d 100644
--- a/src/OpenIddict.Client.SystemNetHttp/OpenIddict.Client.SystemNetHttp.csproj
+++ b/src/OpenIddict.Client.SystemNetHttp/OpenIddict.Client.SystemNetHttp.csproj
@@ -42,10 +42,6 @@
-
-
-
-
diff --git a/src/OpenIddict.Client.SystemNetHttp/OpenIddictClientSystemNetHttpHandlers.Device.cs b/src/OpenIddict.Client.SystemNetHttp/OpenIddictClientSystemNetHttpHandlers.Device.cs
index ac12fb3a..87b3f56f 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; } = ImmutableArray.Create(
+ public static ImmutableArray DefaultHandlers { get; } = [
/*
* DeviceAuthorization request processing:
*/
@@ -38,7 +38,8 @@ public static partial class OpenIddictClientSystemNetHttpHandlers
ExtractJsonHttpResponse.Descriptor,
ExtractWwwAuthenticateHeader.Descriptor,
ValidateHttpResponse.Descriptor,
- DisposeHttpResponse.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 e0cb4048..8fa41c9b 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; } = ImmutableArray.Create(
+ public static ImmutableArray DefaultHandlers { get; } = [
/*
* Configuration request processing:
*/
@@ -55,6 +55,7 @@ public static partial class OpenIddictClientSystemNetHttpHandlers
ExtractJsonHttpResponse.Descriptor,
ExtractWwwAuthenticateHeader.Descriptor,
ValidateHttpResponse.Descriptor,
- DisposeHttpResponse.Descriptor);
+ DisposeHttpResponse.Descriptor
+ ];
}
}
diff --git a/src/OpenIddict.Client.SystemNetHttp/OpenIddictClientSystemNetHttpHandlers.Exchange.cs b/src/OpenIddict.Client.SystemNetHttp/OpenIddictClientSystemNetHttpHandlers.Exchange.cs
index 1684beee..951e2c4a 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; } = ImmutableArray.Create(
+ public static ImmutableArray DefaultHandlers { get; } = [
/*
* Token request processing:
*/
@@ -38,7 +38,8 @@ public static partial class OpenIddictClientSystemNetHttpHandlers
ExtractJsonHttpResponse.Descriptor,
ExtractWwwAuthenticateHeader.Descriptor,
ValidateHttpResponse.Descriptor,
- DisposeHttpResponse.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 5b62d929..7c0b1fb3 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; } = ImmutableArray.Create(
+ public static ImmutableArray DefaultHandlers { get; } = [
/*
* Userinfo request processing:
*/
@@ -39,7 +39,8 @@ public static partial class OpenIddictClientSystemNetHttpHandlers
ExtractJsonHttpResponse.Descriptor,
ExtractWwwAuthenticateHeader.Descriptor,
ValidateHttpResponse.Descriptor,
- DisposeHttpResponse.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 a85e9ac5..b1d3e2ee 100644
--- a/src/OpenIddict.Client.SystemNetHttp/OpenIddictClientSystemNetHttpHandlers.cs
+++ b/src/OpenIddict.Client.SystemNetHttp/OpenIddictClientSystemNetHttpHandlers.cs
@@ -21,12 +21,12 @@ namespace OpenIddict.Client.SystemNetHttp;
[EditorBrowsable(EditorBrowsableState.Never)]
public static partial class OpenIddictClientSystemNetHttpHandlers
{
- public static ImmutableArray DefaultHandlers { get; }
- = ImmutableArray.Create()
- .AddRange(Device.DefaultHandlers)
- .AddRange(Discovery.DefaultHandlers)
- .AddRange(Exchange.DefaultHandlers)
- .AddRange(Userinfo.DefaultHandlers);
+ public static ImmutableArray DefaultHandlers { get; } = [
+ ..Device.DefaultHandlers,
+ ..Discovery.DefaultHandlers,
+ ..Exchange.DefaultHandlers,
+ ..Userinfo.DefaultHandlers
+ ];
///
/// Contains the logic responsible for creating and attaching a .
diff --git a/src/OpenIddict.Client.SystemNetHttp/OpenIddictClientSystemNetHttpOptions.cs b/src/OpenIddict.Client.SystemNetHttp/OpenIddictClientSystemNetHttpOptions.cs
index e5bca464..2cab2ef9 100644
--- a/src/OpenIddict.Client.SystemNetHttp/OpenIddictClientSystemNetHttpOptions.cs
+++ b/src/OpenIddict.Client.SystemNetHttp/OpenIddictClientSystemNetHttpOptions.cs
@@ -42,11 +42,11 @@ public sealed class OpenIddictClientSystemNetHttpOptions
/// Gets the user-defined actions used to amend the
/// instances created by the OpenIddict client/System.Net.Http integration.
///
- public List> HttpClientActions { get; } = new();
+ public List> HttpClientActions { get; } = [];
///
/// Gets the user-defined actions used to amend the
/// instances created by the OpenIddict client/System.Net.Http integration.
///
- public List> HttpClientHandlerActions { get; } = new();
+ public List> HttpClientHandlerActions { get; } = [];
}
diff --git a/src/OpenIddict.Client.WebIntegration/OpenIddict.Client.WebIntegration.csproj b/src/OpenIddict.Client.WebIntegration/OpenIddict.Client.WebIntegration.csproj
index 1a774fe7..4615b46a 100644
--- a/src/OpenIddict.Client.WebIntegration/OpenIddict.Client.WebIntegration.csproj
+++ b/src/OpenIddict.Client.WebIntegration/OpenIddict.Client.WebIntegration.csproj
@@ -27,10 +27,6 @@
-
-
-
-
diff --git a/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.Authentication.cs b/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.Authentication.cs
index 1d7e2577..a24d8b6c 100644
--- a/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.Authentication.cs
+++ b/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.Authentication.cs
@@ -13,11 +13,12 @@ public static partial class OpenIddictClientWebIntegrationHandlers
{
public static class Authentication
{
- public static ImmutableArray DefaultHandlers { get; } = ImmutableArray.Create(
+ public static ImmutableArray DefaultHandlers { get; } = [
/*
* Authorization request preparation:
*/
- MapNonStandardRequestParameters.Descriptor);
+ 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 e410f0e1..876415a7 100644
--- a/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.Device.cs
+++ b/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.Device.cs
@@ -13,11 +13,12 @@ public static partial class OpenIddictClientWebIntegrationHandlers
{
public static class Device
{
- public static ImmutableArray DefaultHandlers { get; } = ImmutableArray.Create(
+ public static ImmutableArray DefaultHandlers { get; } = [
/*
* Token response extraction:
*/
- MapNonStandardResponseParameters.Descriptor);
+ 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 4600724f..4d40320e 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; } = ImmutableArray.Create(
+ public static ImmutableArray DefaultHandlers { get; } = [
/*
* Configuration response handling:
*/
@@ -25,7 +25,8 @@ public static partial class OpenIddictClientWebIntegrationHandlers
AmendScopes.Descriptor,
AmendDeviceAuthorizationEndpointClientAuthenticationMethods.Descriptor,
AmendTokenEndpointClientAuthenticationMethods.Descriptor,
- AmendEndpoints.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 d77a6a23..110ed2ce 100644
--- a/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.Exchange.cs
+++ b/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.Exchange.cs
@@ -23,7 +23,7 @@ public static partial class OpenIddictClientWebIntegrationHandlers
{
public static class Exchange
{
- public static ImmutableArray DefaultHandlers { get; } = ImmutableArray.Create(
+ public static ImmutableArray DefaultHandlers { get; } = [
/*
* Token request preparation:
*/
@@ -36,7 +36,8 @@ public static partial class OpenIddictClientWebIntegrationHandlers
/*
* Token response extraction:
*/
- MapNonStandardResponseParameters.Descriptor);
+ 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 833564a5..241b929e 100644
--- a/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.Protection.cs
+++ b/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.Protection.cs
@@ -14,11 +14,12 @@ public static partial class OpenIddictClientWebIntegrationHandlers
{
public static class Protection
{
- public static ImmutableArray DefaultHandlers { get; } = ImmutableArray.Create(
+ public static ImmutableArray DefaultHandlers { get; } = [
/*
* Token validation:
*/
- AmendTokenValidationParameters.Descriptor);
+ 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.Userinfo.cs b/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.Userinfo.cs
index 3dbd2aab..b6d3d78e 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; } = ImmutableArray.Create(
+ public static ImmutableArray DefaultHandlers { get; } = [
/*
* Userinfo request preparation:
*/
@@ -35,7 +35,8 @@ public static partial class OpenIddictClientWebIntegrationHandlers
* Userinfo response extraction:
*/
NormalizeContentType.Descriptor,
- UnwrapUserinfoResponse.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 5e0178c2..60c9080c 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; } = ImmutableArray.Create(
+ public static ImmutableArray DefaultHandlers { get; } = [
/*
* Authentication processing:
*/
@@ -46,13 +46,15 @@ public static partial class OpenIddictClientWebIntegrationHandlers
OverrideResponseMode.Descriptor,
FormatNonStandardScopeParameter.Descriptor,
IncludeStateParameterInRedirectUri.Descriptor,
- AttachAdditionalChallengeParameters.Descriptor)
- .AddRange(Authentication.DefaultHandlers)
- .AddRange(Device.DefaultHandlers)
- .AddRange(Discovery.DefaultHandlers)
- .AddRange(Exchange.DefaultHandlers)
- .AddRange(Protection.DefaultHandlers)
- .AddRange(Userinfo.DefaultHandlers);
+ AttachAdditionalChallengeParameters.Descriptor,
+
+ ..Authentication.DefaultHandlers,
+ ..Device.DefaultHandlers,
+ ..Discovery.DefaultHandlers,
+ ..Exchange.DefaultHandlers,
+ ..Protection.DefaultHandlers,
+ ..Userinfo.DefaultHandlers
+ ];
///
/// Contains the logic responsible for validating the signature or message authentication
diff --git a/src/OpenIddict.Client/OpenIddict.Client.csproj b/src/OpenIddict.Client/OpenIddict.Client.csproj
index bdd659f4..75dcb635 100644
--- a/src/OpenIddict.Client/OpenIddict.Client.csproj
+++ b/src/OpenIddict.Client/OpenIddict.Client.csproj
@@ -27,10 +27,6 @@ To use the client feature on ASP.NET Core or OWIN/Katana, reference the OpenIddi
-
-
-
-
diff --git a/src/OpenIddict.Client/OpenIddictClientConfiguration.cs b/src/OpenIddict.Client/OpenIddictClientConfiguration.cs
index 4c014dd2..72ce001e 100644
--- a/src/OpenIddict.Client/OpenIddictClientConfiguration.cs
+++ b/src/OpenIddict.Client/OpenIddictClientConfiguration.cs
@@ -81,7 +81,7 @@ public sealed class OpenIddictClientConfiguration : IPostConfigureOptions(), 0, 0);
+ algorithm.TransformFinalBlock([], 0, 0);
registration.RegistrationId = Base64UrlEncoder.Encode(algorithm.Hash);
}
diff --git a/src/OpenIddict.Client/OpenIddictClientHandlerDescriptor.cs b/src/OpenIddict.Client/OpenIddictClientHandlerDescriptor.cs
index 3cf2eb6c..665ba4e3 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; } = ImmutableArray.Create();
+ public ImmutableArray FilterTypes { get; private set; } = [];
///
/// Gets the order assigned to the handler.
@@ -63,7 +63,7 @@ public sealed class OpenIddictClientHandlerDescriptor
public sealed class Builder where TContext : BaseContext
{
private ServiceDescriptor? _descriptor;
- private readonly List _filters = new();
+ private readonly List _filters = [];
private int _order;
private OpenIddictClientHandlerType _type;
diff --git a/src/OpenIddict.Client/OpenIddictClientHandlers.Authentication.cs b/src/OpenIddict.Client/OpenIddictClientHandlers.Authentication.cs
index 846d182b..10f99fd7 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; } = ImmutableArray.Create(
+ public static ImmutableArray DefaultHandlers { get; } = [
/*
* Authorization request top-level processing:
*/
@@ -42,7 +42,8 @@ public static partial class OpenIddictClientHandlers
/*
* Redirection request validation:
*/
- ValidateTokens.Descriptor);
+ 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 6d606a13..96a3cce8 100644
--- a/src/OpenIddict.Client/OpenIddictClientHandlers.Device.cs
+++ b/src/OpenIddict.Client/OpenIddictClientHandlers.Device.cs
@@ -14,13 +14,14 @@ public static partial class OpenIddictClientHandlers
{
public static class Device
{
- public static ImmutableArray DefaultHandlers { get; } = ImmutableArray.Create(
+ public static ImmutableArray DefaultHandlers { get; } = [
/*
* Device authorization response handling:
*/
ValidateWellKnownParameters.Descriptor,
HandleErrorResponse.Descriptor,
- ValidateVerificationEndpointUri.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 b935b034..302e7352 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; } = ImmutableArray.Create(
+ public static ImmutableArray DefaultHandlers { get; } = [
/*
* Configuration response handling:
*/
@@ -42,7 +42,8 @@ public static partial class OpenIddictClientHandlers
*/
ValidateWellKnownCryptographyParameters.Descriptor,
HandleCryptographyErrorResponse.Descriptor,
- ExtractSigningKeys.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 4a9a7b3c..e0f49dd8 100644
--- a/src/OpenIddict.Client/OpenIddictClientHandlers.Exchange.cs
+++ b/src/OpenIddict.Client/OpenIddictClientHandlers.Exchange.cs
@@ -14,12 +14,13 @@ public static partial class OpenIddictClientHandlers
{
public static class Exchange
{
- public static ImmutableArray DefaultHandlers { get; } = ImmutableArray.Create(
+ public static ImmutableArray DefaultHandlers { get; } = [
/*
* Token response handling:
*/
ValidateWellKnownParameters.Descriptor,
- HandleErrorResponse.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.Protection.cs b/src/OpenIddict.Client/OpenIddictClientHandlers.Protection.cs
index f3eacd30..4e1bd9e1 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; } = ImmutableArray.Create(
+ public static ImmutableArray DefaultHandlers { get; } = [
/*
* Token validation:
*/
@@ -38,7 +38,8 @@ public static partial class OpenIddictClientHandlers
AttachSecurityCredentials.Descriptor,
CreateTokenEntry.Descriptor,
GenerateIdentityModelToken.Descriptor,
- AttachTokenPayload.Descriptor);
+ AttachTokenPayload.Descriptor
+ ];
///
/// Contains the logic responsible for resolving the validation parameters used to validate tokens.
@@ -104,29 +105,29 @@ public static partial class OpenIddictClientHandlers
// If the client URI doesn't contain any query/fragment, allow both http://www.fabrikam.com
// and http://www.fabrikam.com/ (the recommended URI representation) to be considered valid.
// See https://datatracker.ietf.org/doc/html/rfc3986#section-6.2.3 for more information.
- { AbsolutePath: "/", Query.Length: 0, Fragment.Length: 0 } uri => new[]
- {
+ { AbsolutePath: "/", Query.Length: 0, Fragment.Length: 0 } uri =>
+ [
uri.AbsoluteUri, // Uri.AbsoluteUri is normalized and always contains a trailing slash.
uri.AbsoluteUri[..^1]
- },
+ ],
// When properly normalized, Uri.AbsolutePath should never be empty and should at least
// contain a leading slash. While dangerous, System.Uri now offers a way to create a URI
// instance without applying the default canonicalization logic. To support such URIs,
// a special case is added here to add back the missing trailing slash when necessary.
- { AbsolutePath.Length: 0, Query.Length: 0, Fragment.Length: 0 } uri => new[]
- {
+ { AbsolutePath.Length: 0, Query.Length: 0, Fragment.Length: 0 } uri =>
+ [
uri.AbsoluteUri,
uri.AbsoluteUri + "/"
- },
+ ],
- Uri uri => new[] { uri.AbsoluteUri }
+ Uri uri => [uri.AbsoluteUri]
};
parameters.ValidateIssuer = parameters.ValidIssuers is not null;
// For state tokens, only the short "oi_stet+jwt" form is valid.
- parameters.ValidTypes = new[] { JsonWebTokenTypes.Private.StateToken };
+ parameters.ValidTypes = [JsonWebTokenTypes.Private.StateToken];
return parameters;
}
@@ -142,23 +143,23 @@ public static partial class OpenIddictClientHandlers
// If the issuer URI doesn't contain any query/fragment, allow both http://www.fabrikam.com
// and http://www.fabrikam.com/ (the recommended URI representation) to be considered valid.
// See https://datatracker.ietf.org/doc/html/rfc3986#section-6.2.3 for more information.
- { AbsolutePath: "/", Query.Length: 0, Fragment.Length: 0 } uri => new[]
- {
+ { AbsolutePath: "/", Query.Length: 0, Fragment.Length: 0 } uri =>
+ [
uri.AbsoluteUri, // Uri.AbsoluteUri is normalized and always contains a trailing slash.
uri.AbsoluteUri[..^1]
- },
+ ],
// When properly normalized, Uri.AbsolutePath should never be empty and should at least
// contain a leading slash. While dangerous, System.Uri now offers a way to create a URI
// instance without applying the default canonicalization logic. To support such URIs,
// a special case is added here to add back the missing trailing slash when necessary.
- { AbsolutePath.Length: 0, Query.Length: 0, Fragment.Length: 0 } uri => new[]
- {
+ { AbsolutePath.Length: 0, Query.Length: 0, Fragment.Length: 0 } uri =>
+ [
uri.AbsoluteUri,
uri.AbsoluteUri + "/"
- },
+ ],
- Uri uri => new[] { uri.AbsoluteUri }
+ Uri uri => [uri.AbsoluteUri]
};
parameters.ValidateIssuer = parameters.ValidIssuers is not null;
diff --git a/src/OpenIddict.Client/OpenIddictClientHandlers.Session.cs b/src/OpenIddict.Client/OpenIddictClientHandlers.Session.cs
index b85ee094..16190430 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; } = ImmutableArray.Create(
+ public static ImmutableArray DefaultHandlers { get; } = [
/*
* Logout request top-level processing:
*/
@@ -37,7 +37,8 @@ public static partial class OpenIddictClientHandlers
/*
* Post-logout redirection request validation:
*/
- ValidateTokens.Descriptor);
+ 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 54c125cf..53a1aa6a 100644
--- a/src/OpenIddict.Client/OpenIddictClientHandlers.Userinfo.cs
+++ b/src/OpenIddict.Client/OpenIddictClientHandlers.Userinfo.cs
@@ -16,13 +16,14 @@ public static partial class OpenIddictClientHandlers
{
public static class Userinfo
{
- public static ImmutableArray DefaultHandlers { get; } = ImmutableArray.Create(
+ public static ImmutableArray DefaultHandlers { get; } = [
/*
* Userinfo response handling:
*/
ValidateWellKnownParameters.Descriptor,
HandleErrorResponse.Descriptor,
- PopulateClaims.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 03f0e652..d065c756 100644
--- a/src/OpenIddict.Client/OpenIddictClientHandlers.cs
+++ b/src/OpenIddict.Client/OpenIddictClientHandlers.cs
@@ -21,7 +21,7 @@ namespace OpenIddict.Client;
[EditorBrowsable(EditorBrowsableState.Never)]
public static partial class OpenIddictClientHandlers
{
- public static ImmutableArray DefaultHandlers { get; } = ImmutableArray.Create(
+ public static ImmutableArray DefaultHandlers { get; } = [
/*
* Top-level request processing:
*/
@@ -148,15 +148,16 @@ public static partial class OpenIddictClientHandlers
* Error processing:
*/
AttachErrorParameters.Descriptor,
- AttachCustomErrorParameters.Descriptor)
-
- .AddRange(Authentication.DefaultHandlers)
- .AddRange(Device.DefaultHandlers)
- .AddRange(Discovery.DefaultHandlers)
- .AddRange(Exchange.DefaultHandlers)
- .AddRange(Protection.DefaultHandlers)
- .AddRange(Session.DefaultHandlers)
- .AddRange(Userinfo.DefaultHandlers);
+ AttachCustomErrorParameters.Descriptor,
+
+ ..Authentication.DefaultHandlers,
+ ..Device.DefaultHandlers,
+ ..Discovery.DefaultHandlers,
+ ..Exchange.DefaultHandlers,
+ ..Protection.DefaultHandlers,
+ ..Session.DefaultHandlers,
+ ..Userinfo.DefaultHandlers
+ ];
///
/// Contains the logic responsible for inferring the endpoint type from the request URI.
diff --git a/src/OpenIddict.Client/OpenIddictClientOptions.cs b/src/OpenIddict.Client/OpenIddictClientOptions.cs
index e38a748b..2d5685be 100644
--- a/src/OpenIddict.Client/OpenIddictClientOptions.cs
+++ b/src/OpenIddict.Client/OpenIddictClientOptions.cs
@@ -45,7 +45,7 @@ public sealed class OpenIddictClientOptions
/// - X.509 keys whose backing certificate is not yet valid are never preferred.
///
///
- public List EncryptionCredentials { get; } = new();
+ public List EncryptionCredentials { get; } = [];
///
/// Gets the list of signing credentials used by the OpenIddict client services.
@@ -63,7 +63,7 @@ public sealed class OpenIddictClientOptions
/// - X.509 keys whose backing certificate is not yet valid are never preferred.
///
///
- public List SigningCredentials { get; } = new();
+ public List SigningCredentials { get; } = [];
///
/// Gets or sets the period of time client assertions remain valid after being issued. The default value is 5 minutes.
@@ -88,17 +88,17 @@ public sealed class OpenIddictClientOptions
///
/// Gets the absolute and relative URIs associated to the redirection endpoint.
///
- public List RedirectionEndpointUris { get; } = new();
+ public List RedirectionEndpointUris { get; } = [];
///
/// Gets the absolute and relative URIs associated to the post-logout redirection endpoint.
///
- public List PostLogoutRedirectionEndpointUris { get; } = new();
+ public List PostLogoutRedirectionEndpointUris { get; } = [];
///
/// Gets the static client registrations used by the OpenIddict client services.
///
- public List Registrations { get; } = new();
+ public List Registrations { get; } = [];
///
/// Gets the token validation parameters used by the OpenIddict client services.
diff --git a/src/OpenIddict.Client/OpenIddictClientRegistration.cs b/src/OpenIddict.Client/OpenIddictClientRegistration.cs
index c1472856..980413bb 100644
--- a/src/OpenIddict.Client/OpenIddictClientRegistration.cs
+++ b/src/OpenIddict.Client/OpenIddictClientRegistration.cs
@@ -54,14 +54,14 @@ public sealed class OpenIddictClientRegistration
/// Multiple credentials can be added to support key rollover, but if X.509 keys
/// are used, at least one of them must have a valid creation/expiration date.
///
- public List EncryptionCredentials { get; } = new();
+ public List EncryptionCredentials { get; } = [];
///
/// Gets the list of signing credentials used to create tokens for this client.
/// Multiple credentials can be added to support key rollover, but if X.509 keys
/// are used, at least one of them must have a valid creation/expiration date.
///
- public List SigningCredentials { get; } = new();
+ public List SigningCredentials { get; } = [];
///
/// Gets the code challenge methods allowed by the client instance.
diff --git a/src/OpenIddict.Core/Managers/OpenIddictApplicationManager.cs b/src/OpenIddict.Core/Managers/OpenIddictApplicationManager.cs
index 1f8679a0..1e293d1d 100644
--- a/src/OpenIddict.Core/Managers/OpenIddictApplicationManager.cs
+++ b/src/OpenIddict.Core/Managers/OpenIddictApplicationManager.cs
@@ -1025,11 +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, ImmutableArray.CreateRange(
- 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, ImmutableArray.CreateRange(
- 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.Core/OpenIddict.Core.csproj b/src/OpenIddict.Core/OpenIddict.Core.csproj
index 76c2a380..c9fad4bf 100644
--- a/src/OpenIddict.Core/OpenIddict.Core.csproj
+++ b/src/OpenIddict.Core/OpenIddict.Core.csproj
@@ -33,10 +33,6 @@
-
-
-
-
diff --git a/src/OpenIddict.EntityFramework.Models/OpenIddict.EntityFramework.Models.csproj b/src/OpenIddict.EntityFramework.Models/OpenIddict.EntityFramework.Models.csproj
index 127feb1b..d7dcafca 100644
--- a/src/OpenIddict.EntityFramework.Models/OpenIddict.EntityFramework.Models.csproj
+++ b/src/OpenIddict.EntityFramework.Models/OpenIddict.EntityFramework.Models.csproj
@@ -9,6 +9,7 @@
+ false
System.Diagnostics.CodeAnalysis.StringSyntaxAttribute
diff --git a/src/OpenIddict.EntityFramework/OpenIddict.EntityFramework.csproj b/src/OpenIddict.EntityFramework/OpenIddict.EntityFramework.csproj
index 5709ecbb..64969bfc 100644
--- a/src/OpenIddict.EntityFramework/OpenIddict.EntityFramework.csproj
+++ b/src/OpenIddict.EntityFramework/OpenIddict.EntityFramework.csproj
@@ -22,10 +22,6 @@
-
-
-
-
diff --git a/src/OpenIddict.EntityFramework/Stores/OpenIddictEntityFrameworkApplicationStore.cs b/src/OpenIddict.EntityFramework/Stores/OpenIddictEntityFrameworkApplicationStore.cs
index c575453a..801394c3 100644
--- a/src/OpenIddict.EntityFramework/Stores/OpenIddictEntityFrameworkApplicationStore.cs
+++ b/src/OpenIddict.EntityFramework/Stores/OpenIddictEntityFrameworkApplicationStore.cs
@@ -473,7 +473,7 @@ public class OpenIddictEntityFrameworkApplicationStore());
+ return new([]);
}
// Note: parsing the stringified permissions is an expensive operation.
@@ -514,7 +514,7 @@ public class OpenIddictEntityFrameworkApplicationStore());
+ return new([]);
}
// Note: parsing the stringified URIs is an expensive operation.
@@ -590,7 +590,7 @@ public class OpenIddictEntityFrameworkApplicationStore());
+ return new([]);
}
// Note: parsing the stringified URIs is an expensive operation.
@@ -631,7 +631,7 @@ public class OpenIddictEntityFrameworkApplicationStore());
+ return new([]);
}
// 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 6408f228..15567df7 100644
--- a/src/OpenIddict.EntityFramework/Stores/OpenIddictEntityFrameworkAuthorizationStore.cs
+++ b/src/OpenIddict.EntityFramework/Stores/OpenIddictEntityFrameworkAuthorizationStore.cs
@@ -478,7 +478,7 @@ public class OpenIddictEntityFrameworkAuthorizationStore());
+ return new([]);
}
// Note: parsing the stringified scopes is an expensive operation.
@@ -660,7 +660,7 @@ public class OpenIddictEntityFrameworkAuthorizationStore(capacity: 1);
+ exceptions ??= [];
exceptions.Add(exception);
}
}
diff --git a/src/OpenIddict.EntityFramework/Stores/OpenIddictEntityFrameworkScopeStore.cs b/src/OpenIddict.EntityFramework/Stores/OpenIddictEntityFrameworkScopeStore.cs
index df26ce1b..b468f092 100644
--- a/src/OpenIddict.EntityFramework/Stores/OpenIddictEntityFrameworkScopeStore.cs
+++ b/src/OpenIddict.EntityFramework/Stores/OpenIddictEntityFrameworkScopeStore.cs
@@ -391,7 +391,7 @@ public class OpenIddictEntityFrameworkScopeStore : IOpen
if (string.IsNullOrEmpty(scope.Resources))
{
- return new(ImmutableArray.Create());
+ return new([]);
}
// Note: parsing the stringified resources is an expensive operation.
diff --git a/src/OpenIddict.EntityFramework/Stores/OpenIddictEntityFrameworkTokenStore.cs b/src/OpenIddict.EntityFramework/Stores/OpenIddictEntityFrameworkTokenStore.cs
index 395b76e6..f5628ed4 100644
--- a/src/OpenIddict.EntityFramework/Stores/OpenIddictEntityFrameworkTokenStore.cs
+++ b/src/OpenIddict.EntityFramework/Stores/OpenIddictEntityFrameworkTokenStore.cs
@@ -640,7 +640,7 @@ public class OpenIddictEntityFrameworkTokenStore(capacity: 1);
+ exceptions ??= [];
exceptions.Add(exception);
}
}
diff --git a/src/OpenIddict.EntityFrameworkCore.Models/OpenIddict.EntityFrameworkCore.Models.csproj b/src/OpenIddict.EntityFrameworkCore.Models/OpenIddict.EntityFrameworkCore.Models.csproj
index 00a49fb3..0e1b1448 100644
--- a/src/OpenIddict.EntityFrameworkCore.Models/OpenIddict.EntityFrameworkCore.Models.csproj
+++ b/src/OpenIddict.EntityFrameworkCore.Models/OpenIddict.EntityFrameworkCore.Models.csproj
@@ -9,6 +9,7 @@
+ false
System.Diagnostics.CodeAnalysis.StringSyntaxAttribute
diff --git a/src/OpenIddict.EntityFrameworkCore/OpenIddict.EntityFrameworkCore.csproj b/src/OpenIddict.EntityFrameworkCore/OpenIddict.EntityFrameworkCore.csproj
index 7aba5872..94886679 100644
--- a/src/OpenIddict.EntityFrameworkCore/OpenIddict.EntityFrameworkCore.csproj
+++ b/src/OpenIddict.EntityFrameworkCore/OpenIddict.EntityFrameworkCore.csproj
@@ -22,10 +22,6 @@
-
-
-
-
diff --git a/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictEntityFrameworkCoreApplicationStore.cs b/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictEntityFrameworkCoreApplicationStore.cs
index 67fbc9cb..ba747c10 100644
--- a/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictEntityFrameworkCoreApplicationStore.cs
+++ b/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictEntityFrameworkCoreApplicationStore.cs
@@ -515,7 +515,7 @@ public class OpenIddictEntityFrameworkCoreApplicationStore());
+ return new([]);
}
// Note: parsing the stringified permissions is an expensive operation.
@@ -556,7 +556,7 @@ public class OpenIddictEntityFrameworkCoreApplicationStore());
+ return new([]);
}
// Note: parsing the stringified URIs is an expensive operation.
@@ -632,7 +632,7 @@ public class OpenIddictEntityFrameworkCoreApplicationStore());
+ return new([]);
}
// Note: parsing the stringified URIs is an expensive operation.
@@ -673,7 +673,7 @@ public class OpenIddictEntityFrameworkCoreApplicationStore());
+ return new([]);
}
// 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 47e21a06..9633fab2 100644
--- a/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictEntityFrameworkCoreAuthorizationStore.cs
+++ b/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictEntityFrameworkCoreAuthorizationStore.cs
@@ -544,7 +544,7 @@ public class OpenIddictEntityFrameworkCoreAuthorizationStore());
+ return new([]);
}
// Note: parsing the stringified scopes is an expensive operation.
@@ -738,7 +738,7 @@ public class OpenIddictEntityFrameworkCoreAuthorizationStore(capacity: 1);
+ exceptions ??= [];
exceptions.Add(exception);
}
}
diff --git a/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictEntityFrameworkCoreScopeStore.cs b/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictEntityFrameworkCoreScopeStore.cs
index c8717e2f..326f59b5 100644
--- a/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictEntityFrameworkCoreScopeStore.cs
+++ b/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictEntityFrameworkCoreScopeStore.cs
@@ -407,7 +407,7 @@ public class OpenIddictEntityFrameworkCoreScopeStore : I
if (string.IsNullOrEmpty(scope.Resources))
{
- return new(ImmutableArray.Create());
+ return new([]);
}
// Note: parsing the stringified resources is an expensive operation.
diff --git a/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictEntityFrameworkCoreTokenStore.cs b/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictEntityFrameworkCoreTokenStore.cs
index 31db2cc2..6d7d4cc8 100644
--- a/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictEntityFrameworkCoreTokenStore.cs
+++ b/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictEntityFrameworkCoreTokenStore.cs
@@ -700,7 +700,7 @@ public class OpenIddictEntityFrameworkCoreTokenStore(capacity: 1);
+ exceptions ??= [];
exceptions.Add(exception);
}
}
diff --git a/src/OpenIddict.MongoDb.Models/OpenIddict.MongoDb.Models.csproj b/src/OpenIddict.MongoDb.Models/OpenIddict.MongoDb.Models.csproj
index 05bec032..4bb9e515 100644
--- a/src/OpenIddict.MongoDb.Models/OpenIddict.MongoDb.Models.csproj
+++ b/src/OpenIddict.MongoDb.Models/OpenIddict.MongoDb.Models.csproj
@@ -9,6 +9,7 @@
true
false
false
+ false
diff --git a/src/OpenIddict.MongoDb/Stores/OpenIddictMongoDbApplicationStore.cs b/src/OpenIddict.MongoDb/Stores/OpenIddictMongoDbApplicationStore.cs
index 141555b5..d6f50c5a 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(ImmutableArray.Create());
+ return new([]);
}
return new(application.Permissions.ToImmutableArray());
@@ -340,7 +340,7 @@ public class OpenIddictMongoDbApplicationStore : IOpenIddictApplic
if (application.PostLogoutRedirectUris is not { Count: > 0 })
{
- return new(ImmutableArray.Create());
+ return new([]);
}
return new(application.PostLogoutRedirectUris.ToImmutableArray());
@@ -381,7 +381,7 @@ public class OpenIddictMongoDbApplicationStore : IOpenIddictApplic
if (application.RedirectUris is not { Count: > 0 })
{
- return new(ImmutableArray.Create());
+ return new([]);
}
return new(application.RedirectUris.ToImmutableArray());
@@ -397,7 +397,7 @@ public class OpenIddictMongoDbApplicationStore : IOpenIddictApplic
if (application.Requirements is not { Count: > 0 })
{
- return new(ImmutableArray.Create());
+ return new([]);
}
return new(application.Requirements.ToImmutableArray());
diff --git a/src/OpenIddict.MongoDb/Stores/OpenIddictMongoDbAuthorizationStore.cs b/src/OpenIddict.MongoDb/Stores/OpenIddictMongoDbAuthorizationStore.cs
index 863c3fb6..bd6bb46f 100644
--- a/src/OpenIddict.MongoDb/Stores/OpenIddictMongoDbAuthorizationStore.cs
+++ b/src/OpenIddict.MongoDb/Stores/OpenIddictMongoDbAuthorizationStore.cs
@@ -414,7 +414,7 @@ public class OpenIddictMongoDbAuthorizationStore : IOpenIddictAu
if (authorization.Scopes is not { Count: > 0 })
{
- return new(ImmutableArray.Create());
+ return new([]);
}
return new(authorization.Scopes.ToImmutableArray());
@@ -549,7 +549,7 @@ public class OpenIddictMongoDbAuthorizationStore : IOpenIddictAu
foreach (var element in source)
{
- buffer ??= new List(capacity: 1);
+ buffer ??= [];
buffer.Add(element);
if (buffer.Count == count)
diff --git a/src/OpenIddict.MongoDb/Stores/OpenIddictMongoDbScopeStore.cs b/src/OpenIddict.MongoDb/Stores/OpenIddictMongoDbScopeStore.cs
index d1961d9c..1a9c9f77 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(ImmutableArray.Create());
+ return new([]);
}
return new(scope.Resources.ToImmutableArray());
diff --git a/src/OpenIddict.MongoDb/Stores/OpenIddictMongoDbTokenStore.cs b/src/OpenIddict.MongoDb/Stores/OpenIddictMongoDbTokenStore.cs
index 6244d143..6310090a 100644
--- a/src/OpenIddict.MongoDb/Stores/OpenIddictMongoDbTokenStore.cs
+++ b/src/OpenIddict.MongoDb/Stores/OpenIddictMongoDbTokenStore.cs
@@ -586,7 +586,7 @@ public class OpenIddictMongoDbTokenStore : IOpenIddictTokenStore
foreach (var element in source)
{
- buffer ??= new List(capacity: 1);
+ buffer ??= [];
buffer.Add(element);
if (buffer.Count == count)
diff --git a/src/OpenIddict.Owin/OpenIddict.Owin.csproj b/src/OpenIddict.Owin/OpenIddict.Owin.csproj
index 1c460523..3758b2c2 100644
--- a/src/OpenIddict.Owin/OpenIddict.Owin.csproj
+++ b/src/OpenIddict.Owin/OpenIddict.Owin.csproj
@@ -4,6 +4,7 @@
$(NetFrameworkTargetFrameworks)
false
false
+ false
diff --git a/src/OpenIddict.Quartz/OpenIddict.Quartz.csproj b/src/OpenIddict.Quartz/OpenIddict.Quartz.csproj
index acda8456..b3293c82 100644
--- a/src/OpenIddict.Quartz/OpenIddict.Quartz.csproj
+++ b/src/OpenIddict.Quartz/OpenIddict.Quartz.csproj
@@ -21,10 +21,6 @@
-
-
-
-
diff --git a/src/OpenIddict.Quartz/OpenIddictQuartzJob.cs b/src/OpenIddict.Quartz/OpenIddictQuartzJob.cs
index bb56dd1b..9e7a15c7 100644
--- a/src/OpenIddict.Quartz/OpenIddictQuartzJob.cs
+++ b/src/OpenIddict.Quartz/OpenIddictQuartzJob.cs
@@ -66,19 +66,13 @@ public sealed class OpenIddictQuartzJob : IJob
if (!_options.CurrentValue.DisableTokenPruning)
{
- var manager = scope.ServiceProvider.GetService();
- if (manager is null)
- {
- // Inform Quartz.NET that the triggers associated with this job should be removed,
- // as the future invocations will always fail until the application is correctly
- // re-configured to register the OpenIddict core services in the DI container.
+ var manager = scope.ServiceProvider.GetService() ??
throw new JobExecutionException(new InvalidOperationException(SR.GetResourceString(SR.ID0278)))
{
RefireImmediately = false,
UnscheduleAllTriggers = true,
UnscheduleFiringTrigger = true
};
- }
var threshold = DateTimeOffset.UtcNow - _options.CurrentValue.MinimumTokenLifespan;
@@ -102,7 +96,7 @@ public sealed class OpenIddictQuartzJob : IJob
// occurred while trying to prune the entities. In this case, add the inner exceptions to the collection.
catch (AggregateException exception) when (!OpenIddictHelpers.IsFatal(exception))
{
- exceptions ??= new List(capacity: exception.InnerExceptions.Count);
+ exceptions ??= [];
exceptions.AddRange(exception.InnerExceptions);
}
@@ -110,26 +104,20 @@ public sealed class OpenIddictQuartzJob : IJob
// to be re-thrown later (typically, at the very end of this job, as an AggregateException).
catch (Exception exception) when (!OpenIddictHelpers.IsFatal(exception))
{
- exceptions ??= new List(capacity: 1);
+ exceptions ??= [];
exceptions.Add(exception);
}
}
if (!_options.CurrentValue.DisableAuthorizationPruning)
{
- var manager = scope.ServiceProvider.GetService();
- if (manager is null)
- {
- // Inform Quartz.NET that the triggers associated with this job should be removed,
- // as the future invocations will always fail until the application is correctly
- // re-configured to register the OpenIddict core services in the DI container.
+ var manager = scope.ServiceProvider.GetService() ??
throw new JobExecutionException(new InvalidOperationException(SR.GetResourceString(SR.ID0278)))
{
RefireImmediately = false,
UnscheduleAllTriggers = true,
UnscheduleFiringTrigger = true
};
- }
var threshold = DateTimeOffset.UtcNow - _options.CurrentValue.MinimumAuthorizationLifespan;
@@ -153,7 +141,7 @@ public sealed class OpenIddictQuartzJob : IJob
// occurred while trying to prune the entities. In this case, add the inner exceptions to the collection.
catch (AggregateException exception) when (!OpenIddictHelpers.IsFatal(exception))
{
- exceptions ??= new List(capacity: exception.InnerExceptions.Count);
+ exceptions ??= [];
exceptions.AddRange(exception.InnerExceptions);
}
@@ -161,7 +149,7 @@ public sealed class OpenIddictQuartzJob : IJob
// to be re-thrown later (typically, at the very end of this job, as an AggregateException).
catch (Exception exception) when (!OpenIddictHelpers.IsFatal(exception))
{
- exceptions ??= new List(capacity: 1);
+ exceptions ??= [];
exceptions.Add(exception);
}
}
diff --git a/src/OpenIddict.Server.AspNetCore/OpenIddict.Server.AspNetCore.csproj b/src/OpenIddict.Server.AspNetCore/OpenIddict.Server.AspNetCore.csproj
index 50e22f5d..f6f86253 100644
--- a/src/OpenIddict.Server.AspNetCore/OpenIddict.Server.AspNetCore.csproj
+++ b/src/OpenIddict.Server.AspNetCore/OpenIddict.Server.AspNetCore.csproj
@@ -27,10 +27,6 @@
-
-
-
-
diff --git a/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.Authentication.cs b/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.Authentication.cs
index 1aa101bf..597415cb 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; } = ImmutableArray.Create(
+ public static ImmutableArray DefaultHandlers { get; } = [
/*
* Authorization request extraction:
*/
@@ -52,7 +52,8 @@ public static partial class OpenIddictServerAspNetCoreHandlers
ProcessFragmentResponse.Descriptor,
ProcessPassthroughErrorResponse.Descriptor,
ProcessStatusCodePagesErrorResponse.Descriptor,
- ProcessLocalErrorResponse.Descriptor);
+ ProcessLocalErrorResponse.Descriptor
+ ];
///
/// Contains the logic responsible for restoring cached requests from the request_id, if specified.
@@ -115,7 +116,7 @@ public static partial class OpenIddictServerAspNetCoreHandlers
var parameters = context.Options.TokenValidationParameters.Clone();
parameters.ValidIssuer ??= (context.Options.Issuer ?? context.BaseUri)?.AbsoluteUri;
parameters.ValidAudience ??= parameters.ValidIssuer;
- parameters.ValidTypes = new[] { JsonWebTokenTypes.Private.AuthorizationRequest };
+ parameters.ValidTypes = [JsonWebTokenTypes.Private.AuthorizationRequest];
var result = await context.Options.JsonWebTokenHandler.ValidateTokenAsync(token, parameters);
if (!result.IsValid)
@@ -196,11 +197,8 @@ public static partial class OpenIddictServerAspNetCoreHandlers
// This handler only applies to ASP.NET Core requests. If the HTTP context cannot be resolved,
// this may indicate that the request was incorrectly processed by another server stack.
- var request = context.Transaction.GetHttpRequest();
- if (request is null)
- {
+ var request = context.Transaction.GetHttpRequest() ??
throw new InvalidOperationException(SR.GetResourceString(SR.ID0114));
- }
// Don't cache the request if the request doesn't include any parameter.
// If a request_id parameter can be found in the authorization request,
diff --git a/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.Device.cs b/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.Device.cs
index fc096e20..2a74055c 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; } = ImmutableArray.Create(
+ public static ImmutableArray DefaultHandlers { get; } = [
/*
* Device request extraction:
*/
@@ -49,7 +49,8 @@ public static partial class OpenIddictServerAspNetCoreHandlers
ProcessPassthroughErrorResponse.Descriptor,
ProcessStatusCodePagesErrorResponse.Descriptor,
ProcessLocalErrorResponse.Descriptor,
- ProcessEmptyResponse.Descriptor);
+ ProcessEmptyResponse.Descriptor
+ ];
}
///
diff --git a/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.Discovery.cs b/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.Discovery.cs
index 4b1a80df..dea4b63d 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; } = ImmutableArray.Create(
+ public static ImmutableArray DefaultHandlers { get; } = [
/*
* Configuration request extraction:
*/
@@ -35,6 +35,7 @@ public static partial class OpenIddictServerAspNetCoreHandlers
*/
AttachHttpResponseCode.Descriptor,
AttachWwwAuthenticateHeader.Descriptor,
- ProcessJsonResponse.Descriptor);
+ ProcessJsonResponse.Descriptor
+ ];
}
}
diff --git a/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.Exchange.cs b/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.Exchange.cs
index 39df0cc8..34f79c73 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; } = ImmutableArray.Create(
+ public static ImmutableArray DefaultHandlers { get; } = [
/*
* Token request extraction:
*/
@@ -31,6 +31,7 @@ public static partial class OpenIddictServerAspNetCoreHandlers
AttachHttpResponseCode.Descriptor,
AttachCacheControlHeader.Descriptor,
AttachWwwAuthenticateHeader.Descriptor,
- ProcessJsonResponse.Descriptor);
+ ProcessJsonResponse.Descriptor
+ ];
}
}
diff --git a/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.Introspection.cs b/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.Introspection.cs
index b6d31198..11c0c474 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; } = ImmutableArray.Create(
+ public static ImmutableArray DefaultHandlers { get; } = [
/*
* Introspection request extraction:
*/
@@ -25,6 +25,7 @@ public static partial class OpenIddictServerAspNetCoreHandlers
*/
AttachHttpResponseCode.Descriptor,
AttachWwwAuthenticateHeader.Descriptor,
- ProcessJsonResponse.Descriptor);
+ ProcessJsonResponse.Descriptor
+ ];
}
}
diff --git a/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.Revocation.cs b/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.Revocation.cs
index 59f03575..c81f2282 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; } = ImmutableArray.Create(
+ public static ImmutableArray DefaultHandlers { get; } = [
/*
* Revocation request extraction:
*/
@@ -26,6 +26,7 @@ public static partial class OpenIddictServerAspNetCoreHandlers
AttachHttpResponseCode.Descriptor,
AttachCacheControlHeader.Descriptor,
AttachWwwAuthenticateHeader.Descriptor,
- ProcessJsonResponse.Descriptor);
+ ProcessJsonResponse.Descriptor
+ ];
}
}
diff --git a/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.Session.cs b/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.Session.cs
index 4a5b7a64..01ab0209 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; } = ImmutableArray.Create(
+ public static ImmutableArray DefaultHandlers { get; } = [
/*
* Logout request extraction:
*/
@@ -49,7 +49,8 @@ public static partial class OpenIddictServerAspNetCoreHandlers
ProcessStatusCodePagesErrorResponse.Descriptor,
ProcessLocalErrorResponse.Descriptor,
ProcessQueryResponse.Descriptor,
- ProcessEmptyResponse.Descriptor);
+ ProcessEmptyResponse.Descriptor
+ ];
///
/// Contains the logic responsible for restoring cached requests from the request_id, if specified.
@@ -112,7 +113,7 @@ public static partial class OpenIddictServerAspNetCoreHandlers
var parameters = context.Options.TokenValidationParameters.Clone();
parameters.ValidIssuer ??= (context.Options.Issuer ?? context.BaseUri)?.AbsoluteUri;
parameters.ValidAudience ??= parameters.ValidIssuer;
- parameters.ValidTypes = new[] { JsonWebTokenTypes.Private.LogoutRequest };
+ parameters.ValidTypes = [JsonWebTokenTypes.Private.LogoutRequest];
var result = await context.Options.JsonWebTokenHandler.ValidateTokenAsync(token, parameters);
if (!result.IsValid)
@@ -193,11 +194,8 @@ public static partial class OpenIddictServerAspNetCoreHandlers
// This handler only applies to ASP.NET Core requests. If the HTTP context cannot be resolved,
// this may indicate that the request was incorrectly processed by another server stack.
- var request = context.Transaction.GetHttpRequest();
- if (request is null)
- {
+ var request = context.Transaction.GetHttpRequest() ??
throw new InvalidOperationException(SR.GetResourceString(SR.ID0114));
- }
// Don't cache the request if the request doesn't include any parameter.
// If a request_id parameter can be found in the logout request,
diff --git a/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.Userinfo.cs b/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.Userinfo.cs
index e4d11a0b..f3857039 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; } = ImmutableArray.Create(
+ public static ImmutableArray DefaultHandlers { get; } = [
/*
* Userinfo request extraction:
*/
@@ -30,6 +30,7 @@ public static partial class OpenIddictServerAspNetCoreHandlers
AttachHttpResponseCode.Descriptor,
AttachWwwAuthenticateHeader.Descriptor,
ProcessChallengeErrorResponse.Descriptor,
- ProcessJsonResponse.Descriptor);
+ ProcessJsonResponse.Descriptor
+ ];
}
}
diff --git a/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.cs b/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.cs
index 3239a855..3af789f1 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; } = ImmutableArray.Create(
+ public static ImmutableArray DefaultHandlers { get; } = [
/*
* Top-level request processing:
*/
@@ -50,15 +50,17 @@ public static partial class OpenIddictServerAspNetCoreHandlers
/*
* Sign-out processing:
*/
- ResolveHostSignOutProperties.Descriptor)
- .AddRange(Authentication.DefaultHandlers)
- .AddRange(Device.DefaultHandlers)
- .AddRange(Discovery.DefaultHandlers)
- .AddRange(Exchange.DefaultHandlers)
- .AddRange(Introspection.DefaultHandlers)
- .AddRange(Revocation.DefaultHandlers)
- .AddRange(Session.DefaultHandlers)
- .AddRange(Userinfo.DefaultHandlers);
+ ResolveHostSignOutProperties.Descriptor,
+
+ ..Authentication.DefaultHandlers,
+ ..Device.DefaultHandlers,
+ ..Discovery.DefaultHandlers,
+ ..Exchange.DefaultHandlers,
+ ..Introspection.DefaultHandlers,
+ ..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/OpenIddict.Server.DataProtection.csproj b/src/OpenIddict.Server.DataProtection/OpenIddict.Server.DataProtection.csproj
index d89a58aa..e7aabb11 100644
--- a/src/OpenIddict.Server.DataProtection/OpenIddict.Server.DataProtection.csproj
+++ b/src/OpenIddict.Server.DataProtection/OpenIddict.Server.DataProtection.csproj
@@ -29,10 +29,6 @@
-
-
-
-
diff --git a/src/OpenIddict.Server.DataProtection/OpenIddictServerDataProtectionHandlers.Protection.cs b/src/OpenIddict.Server.DataProtection/OpenIddictServerDataProtectionHandlers.Protection.cs
index f13ed354..c64a59ab 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; } = ImmutableArray.Create(
+ public static ImmutableArray DefaultHandlers { get; } = [
/*
* Token validation:
*/
@@ -31,7 +31,8 @@ public static partial class OpenIddictServerDataProtectionHandlers
* Token generation:
*/
OverrideGeneratedTokenFormat.Descriptor,
- GenerateDataProtectionToken.Descriptor);
+ GenerateDataProtectionToken.Descriptor
+ ];
///
/// Contains the logic responsible for validating tokens generated using Data Protection.
@@ -209,29 +210,29 @@ public static partial class OpenIddictServerDataProtectionHandlers
(type, context.IsReferenceToken) switch
{
(TokenTypeHints.AccessToken, true)
- => new[] { Handlers.Server, Formats.AccessToken, Features.ReferenceTokens, Schemes.Server },
+ => [Handlers.Server, Formats.AccessToken, Features.ReferenceTokens, Schemes.Server],
(TokenTypeHints.AccessToken, false)
- => new[] { Handlers.Server, Formats.AccessToken, Schemes.Server },
+ => [Handlers.Server, Formats.AccessToken, Schemes.Server],
(TokenTypeHints.AuthorizationCode, true)
- => new[] { Handlers.Server, Formats.AuthorizationCode, Features.ReferenceTokens, Schemes.Server },
+ => [Handlers.Server, Formats.AuthorizationCode, Features.ReferenceTokens, Schemes.Server],
(TokenTypeHints.AuthorizationCode, false)
- => new[] { Handlers.Server, Formats.AuthorizationCode, Schemes.Server },
+ => [Handlers.Server, Formats.AuthorizationCode, Schemes.Server],
(TokenTypeHints.DeviceCode, true)
- => new[] { Handlers.Server, Formats.DeviceCode, Features.ReferenceTokens, Schemes.Server },
+ => [Handlers.Server, Formats.DeviceCode, Features.ReferenceTokens, Schemes.Server],
(TokenTypeHints.DeviceCode, false)
- => new[] { Handlers.Server, Formats.DeviceCode, Schemes.Server },
+ => [Handlers.Server, Formats.DeviceCode, Schemes.Server],
(TokenTypeHints.RefreshToken, true)
- => new[] { Handlers.Server, Formats.RefreshToken, Features.ReferenceTokens, Schemes.Server },
+ => [Handlers.Server, Formats.RefreshToken, Features.ReferenceTokens, Schemes.Server],
(TokenTypeHints.RefreshToken, false)
- => new[] { Handlers.Server, Formats.RefreshToken, Schemes.Server },
+ => [Handlers.Server, Formats.RefreshToken, Schemes.Server],
(TokenTypeHints.UserCode, true)
- => new[] { Handlers.Server, Formats.UserCode, Features.ReferenceTokens, Schemes.Server },
+ => [Handlers.Server, Formats.UserCode, Features.ReferenceTokens, Schemes.Server],
(TokenTypeHints.UserCode, false)
- => new[] { Handlers.Server, Formats.UserCode, Schemes.Server },
+ => [Handlers.Server, Formats.UserCode, Schemes.Server],
_ => throw new InvalidOperationException(SR.GetResourceString(SR.ID0003))
});
@@ -357,29 +358,29 @@ public static partial class OpenIddictServerDataProtectionHandlers
(context.TokenType, context.IsReferenceToken) switch
{
(TokenTypeHints.AccessToken, true)
- => new[] { Handlers.Server, Formats.AccessToken, Features.ReferenceTokens, Schemes.Server },
+ => [Handlers.Server, Formats.AccessToken, Features.ReferenceTokens, Schemes.Server],
(TokenTypeHints.AccessToken, false)
- => new[] { Handlers.Server, Formats.AccessToken, Schemes.Server },
+ => [Handlers.Server, Formats.AccessToken, Schemes.Server],
(TokenTypeHints.AuthorizationCode, true)
- => new[] { Handlers.Server, Formats.AuthorizationCode, Features.ReferenceTokens, Schemes.Server },
+ => [Handlers.Server, Formats.AuthorizationCode, Features.ReferenceTokens, Schemes.Server],
(TokenTypeHints.AuthorizationCode, false)
- => new[] { Handlers.Server, Formats.AuthorizationCode, Schemes.Server },
+ => [Handlers.Server, Formats.AuthorizationCode, Schemes.Server],
(TokenTypeHints.DeviceCode, true)
- => new[] { Handlers.Server, Formats.DeviceCode, Features.ReferenceTokens, Schemes.Server },
+ => [Handlers.Server, Formats.DeviceCode, Features.ReferenceTokens, Schemes.Server],
(TokenTypeHints.DeviceCode, false)
- => new[] { Handlers.Server, Formats.DeviceCode, Schemes.Server },
+ => [Handlers.Server, Formats.DeviceCode, Schemes.Server],
(TokenTypeHints.RefreshToken, true)
- => new[] { Handlers.Server, Formats.RefreshToken, Features.ReferenceTokens, Schemes.Server },
+ => [Handlers.Server, Formats.RefreshToken, Features.ReferenceTokens, Schemes.Server],
(TokenTypeHints.RefreshToken, false)
- => new[] { Handlers.Server, Formats.RefreshToken, Schemes.Server },
+ => [Handlers.Server, Formats.RefreshToken, Schemes.Server],
(TokenTypeHints.UserCode, true)
- => new[] { Handlers.Server, Formats.UserCode, Features.ReferenceTokens, Schemes.Server },
+ => [Handlers.Server, Formats.UserCode, Features.ReferenceTokens, Schemes.Server],
(TokenTypeHints.UserCode, false)
- => new[] { Handlers.Server, Formats.UserCode, Schemes.Server },
+ => [Handlers.Server, Formats.UserCode, Schemes.Server],
_ => throw new InvalidOperationException(SR.GetResourceString(SR.ID0003))
});
diff --git a/src/OpenIddict.Server.DataProtection/OpenIddictServerDataProtectionHandlers.cs b/src/OpenIddict.Server.DataProtection/OpenIddictServerDataProtectionHandlers.cs
index 3e539c1a..08c5066d 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; }
- = ImmutableArray.CreateRange(Protection.DefaultHandlers);
+ = [..Protection.DefaultHandlers];
}
diff --git a/src/OpenIddict.Server.Owin/OpenIddict.Server.Owin.csproj b/src/OpenIddict.Server.Owin/OpenIddict.Server.Owin.csproj
index f33a5570..e565ce35 100644
--- a/src/OpenIddict.Server.Owin/OpenIddict.Server.Owin.csproj
+++ b/src/OpenIddict.Server.Owin/OpenIddict.Server.Owin.csproj
@@ -19,10 +19,6 @@
-
-
-
-
diff --git a/src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.Authentication.cs b/src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.Authentication.cs
index eec88ada..c1681cef 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; } = ImmutableArray.Create(
+ public static ImmutableArray DefaultHandlers { get; } = [
/*
* Authorization request extraction:
*/
@@ -51,7 +51,8 @@ public static partial class OpenIddictServerOwinHandlers
ProcessQueryResponse.Descriptor,
ProcessFragmentResponse.Descriptor,
ProcessPassthroughErrorResponse.Descriptor,
- ProcessLocalErrorResponse.Descriptor);
+ ProcessLocalErrorResponse.Descriptor
+ ];
///
/// Contains the logic responsible for restoring cached requests from the request_id, if specified.
@@ -114,7 +115,7 @@ public static partial class OpenIddictServerOwinHandlers
var parameters = context.Options.TokenValidationParameters.Clone();
parameters.ValidIssuer ??= (context.Options.Issuer ?? context.BaseUri)?.AbsoluteUri;
parameters.ValidAudience ??= parameters.ValidIssuer;
- parameters.ValidTypes = new[] { JsonWebTokenTypes.Private.AuthorizationRequest };
+ parameters.ValidTypes = [JsonWebTokenTypes.Private.AuthorizationRequest];
var result = await context.Options.JsonWebTokenHandler.ValidateTokenAsync(token, parameters);
if (!result.IsValid)
@@ -338,11 +339,8 @@ public static partial class OpenIddictServerOwinHandlers
// This handler only applies to OWIN requests. If The OWIN request cannot be resolved,
// this may indicate that the request was incorrectly processed by another server stack.
- var response = context.Transaction.GetOwinRequest()?.Context.Response;
- if (response is null)
- {
+ var response = context.Transaction.GetOwinRequest()?.Context.Response ??
throw new InvalidOperationException(SR.GetResourceString(SR.ID0120));
- }
if (string.IsNullOrEmpty(context.RedirectUri) ||
!string.Equals(context.ResponseMode, ResponseModes.FormPost, StringComparison.Ordinal))
@@ -427,11 +425,8 @@ public static partial class OpenIddictServerOwinHandlers
// This handler only applies to OWIN requests. If The OWIN request cannot be resolved,
// this may indicate that the request was incorrectly processed by another server stack.
- var response = context.Transaction.GetOwinRequest()?.Context.Response;
- if (response is null)
- {
+ var response = context.Transaction.GetOwinRequest()?.Context.Response ??
throw new InvalidOperationException(SR.GetResourceString(SR.ID0120));
- }
if (string.IsNullOrEmpty(context.RedirectUri) ||
!string.Equals(context.ResponseMode, ResponseModes.Query, StringComparison.Ordinal))
@@ -491,11 +486,8 @@ public static partial class OpenIddictServerOwinHandlers
// This handler only applies to OWIN requests. If The OWIN request cannot be resolved,
// this may indicate that the request was incorrectly processed by another server stack.
- var response = context.Transaction.GetOwinRequest()?.Context.Response;
- if (response is null)
- {
+ var response = context.Transaction.GetOwinRequest()?.Context.Response ??
throw new InvalidOperationException(SR.GetResourceString(SR.ID0120));
- }
if (string.IsNullOrEmpty(context.RedirectUri) ||
!string.Equals(context.ResponseMode, ResponseModes.Fragment, StringComparison.Ordinal))
diff --git a/src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.Device.cs b/src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.Device.cs
index 112789dd..b102e62d 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; } = ImmutableArray.Create(
+ public static ImmutableArray DefaultHandlers { get; } = [
/*
* Device request extraction:
*/
@@ -52,7 +52,8 @@ public static partial class OpenIddictServerOwinHandlers
ProcessHostRedirectionResponse.Descriptor,
ProcessPassthroughErrorResponse.Descriptor,
ProcessLocalErrorResponse.Descriptor,
- ProcessEmptyResponse.Descriptor);
+ ProcessEmptyResponse.Descriptor
+ ];
}
///
diff --git a/src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.Discovery.cs b/src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.Discovery.cs
index ac32e5dd..7827b55c 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; } = ImmutableArray.Create(
+ public static ImmutableArray DefaultHandlers { get; } = [
/*
* Configuration request extraction:
*/
@@ -39,6 +39,7 @@ public static partial class OpenIddictServerOwinHandlers
AttachOwinResponseChallenge.Descriptor,
SuppressFormsAuthenticationRedirect.Descriptor,
AttachWwwAuthenticateHeader.Descriptor,
- ProcessJsonResponse.Descriptor);
+ ProcessJsonResponse.Descriptor
+ ];
}
}
diff --git a/src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.Exchange.cs b/src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.Exchange.cs
index 86ea552d..7d0ab315 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; } = ImmutableArray.Create(
+ public static ImmutableArray DefaultHandlers { get; } = [
/*
* Token request extraction:
*/
@@ -33,6 +33,7 @@ public static partial class OpenIddictServerOwinHandlers
SuppressFormsAuthenticationRedirect.Descriptor,
AttachCacheControlHeader.Descriptor,
AttachWwwAuthenticateHeader.Descriptor,
- ProcessJsonResponse.Descriptor);
+ ProcessJsonResponse.Descriptor
+ ];
}
}
diff --git a/src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.Introspection.cs b/src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.Introspection.cs
index a8e63431..cdbe52a3 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; } = ImmutableArray.Create(
+ public static ImmutableArray DefaultHandlers { get; } = [
/*
* Introspection request extraction:
*/
@@ -27,6 +27,7 @@ public static partial class OpenIddictServerOwinHandlers
AttachOwinResponseChallenge.Descriptor,
SuppressFormsAuthenticationRedirect.Descriptor,
AttachWwwAuthenticateHeader.Descriptor,
- ProcessJsonResponse.Descriptor);
+ ProcessJsonResponse.Descriptor
+ ];
}
}
diff --git a/src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.Revocation.cs b/src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.Revocation.cs
index 04facc82..1f0a51f7 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; } = ImmutableArray.Create(
+ public static ImmutableArray DefaultHandlers { get; } = [
/*
* Revocation request extraction:
*/
@@ -28,6 +28,7 @@ public static partial class OpenIddictServerOwinHandlers
SuppressFormsAuthenticationRedirect.Descriptor,
AttachCacheControlHeader.Descriptor,
AttachWwwAuthenticateHeader.Descriptor,
- ProcessJsonResponse.Descriptor);
+ ProcessJsonResponse.Descriptor
+ ];
}
}
diff --git a/src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.Session.cs b/src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.Session.cs
index 4a1cf06e..f26c660a 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; } = ImmutableArray.Create(
+ public static ImmutableArray DefaultHandlers { get; } = [
/*
* Logout request extraction:
*/
@@ -49,7 +49,8 @@ public static partial class OpenIddictServerOwinHandlers
ProcessPassthroughErrorResponse.Descriptor,
ProcessLocalErrorResponse.Descriptor,
ProcessQueryResponse.Descriptor,
- ProcessEmptyResponse.Descriptor);
+ ProcessEmptyResponse.Descriptor
+ ];
///
/// Contains the logic responsible for restoring cached requests from the request_id, if specified.
@@ -112,7 +113,7 @@ public static partial class OpenIddictServerOwinHandlers
var parameters = context.Options.TokenValidationParameters.Clone();
parameters.ValidIssuer ??= (context.Options.Issuer ?? context.BaseUri)?.AbsoluteUri;
parameters.ValidAudience ??= parameters.ValidIssuer;
- parameters.ValidTypes = new[] { JsonWebTokenTypes.Private.LogoutRequest };
+ parameters.ValidTypes = [JsonWebTokenTypes.Private.LogoutRequest];
var result = await context.Options.JsonWebTokenHandler.ValidateTokenAsync(token, parameters);
if (!result.IsValid)
@@ -331,11 +332,8 @@ public static partial class OpenIddictServerOwinHandlers
// This handler only applies to OWIN requests. If The OWIN request cannot be resolved,
// this may indicate that the request was incorrectly processed by another server stack.
- var response = context.Transaction.GetOwinRequest()?.Context.Response;
- if (response is null)
- {
+ var response = context.Transaction.GetOwinRequest()?.Context.Response ??
throw new InvalidOperationException(SR.GetResourceString(SR.ID0120));
- }
if (string.IsNullOrEmpty(context.PostLogoutRedirectUri))
{
@@ -394,11 +392,8 @@ public static partial class OpenIddictServerOwinHandlers
// This handler only applies to OWIN requests. If The OWIN request cannot be resolved,
// this may indicate that the request was incorrectly processed by another server stack.
- var response = context.Transaction.GetOwinRequest()?.Context.Response;
- if (response is null)
- {
+ var response = context.Transaction.GetOwinRequest()?.Context.Response ??
throw new InvalidOperationException(SR.GetResourceString(SR.ID0120));
- }
// Note: this handler only executes if no post_logout_redirect_uri was specified
// and if the response doesn't correspond to an error, that must be handled locally.
diff --git a/src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.Userinfo.cs b/src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.Userinfo.cs
index 3d6e74d0..23addd07 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; } = ImmutableArray.Create(
+ public static ImmutableArray DefaultHandlers { get; } = [
/*
* Userinfo request extraction:
*/
@@ -32,6 +32,7 @@ public static partial class OpenIddictServerOwinHandlers
SuppressFormsAuthenticationRedirect.Descriptor,
AttachWwwAuthenticateHeader.Descriptor,
ProcessChallengeErrorResponse.Descriptor,
- ProcessJsonResponse.Descriptor);
+ ProcessJsonResponse.Descriptor
+ ];
}
}
diff --git a/src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.cs b/src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.cs
index 4bb7481e..3a05420e 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; } = ImmutableArray.Create(
+ public static ImmutableArray DefaultHandlers { get; } = [
/*
* Top-level request processing:
*/
@@ -45,15 +45,17 @@ public static partial class OpenIddictServerOwinHandlers
/*
* Sign-out processing:
*/
- ResolveHostSignOutProperties.Descriptor)
- .AddRange(Authentication.DefaultHandlers)
- .AddRange(Device.DefaultHandlers)
- .AddRange(Discovery.DefaultHandlers)
- .AddRange(Exchange.DefaultHandlers)
- .AddRange(Introspection.DefaultHandlers)
- .AddRange(Revocation.DefaultHandlers)
- .AddRange(Session.DefaultHandlers)
- .AddRange(Userinfo.DefaultHandlers);
+ ResolveHostSignOutProperties.Descriptor,
+
+ ..Authentication.DefaultHandlers,
+ ..Device.DefaultHandlers,
+ ..Discovery.DefaultHandlers,
+ ..Exchange.DefaultHandlers,
+ ..Introspection.DefaultHandlers,
+ ..Revocation.DefaultHandlers,
+ ..Session.DefaultHandlers,
+ ..Userinfo.DefaultHandlers
+ ];
///
/// Contains the logic responsible for resolving the request URI from the OWIN environment.
@@ -1047,7 +1049,7 @@ public static partial class OpenIddictServerOwinHandlers
response.Context.Authentication.AuthenticationResponseChallenge is null)
{
response.Context.Authentication.AuthenticationResponseChallenge =
- new AuthenticationResponseChallenge(new[] { Guid.NewGuid().ToString() }, null);
+ new AuthenticationResponseChallenge([Guid.NewGuid().ToString()], null);
}
return default;
diff --git a/src/OpenIddict.Server/OpenIddict.Server.csproj b/src/OpenIddict.Server/OpenIddict.Server.csproj
index 468786c8..2ed0a516 100644
--- a/src/OpenIddict.Server/OpenIddict.Server.csproj
+++ b/src/OpenIddict.Server/OpenIddict.Server.csproj
@@ -25,10 +25,6 @@ To use the server feature on ASP.NET Core or OWIN/Katana, reference the OpenIddi
-
-
-
-
diff --git a/src/OpenIddict.Server/OpenIddictServerEvents.Discovery.cs b/src/OpenIddict.Server/OpenIddictServerEvents.Discovery.cs
index 855b1a28..092200b8 100644
--- a/src/OpenIddict.Server/OpenIddictServerEvents.Discovery.cs
+++ b/src/OpenIddict.Server/OpenIddictServerEvents.Discovery.cs
@@ -325,7 +325,7 @@ public static partial class OpenIddictServerEvents
///
/// Gets the list of JSON Web Keys exposed by the JWKS endpoint.
///
- public List Keys { get; } = new List();
+ public List Keys { get; } = [];
}
///
diff --git a/src/OpenIddict.Server/OpenIddictServerHandlerDescriptor.cs b/src/OpenIddict.Server/OpenIddictServerHandlerDescriptor.cs
index c3c98819..ac613631 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; } = ImmutableArray.Create();
+ public ImmutableArray FilterTypes { get; private set; } = [];
///
/// Gets the order assigned to the handler.
@@ -63,7 +63,7 @@ public sealed class OpenIddictServerHandlerDescriptor
public sealed class Builder where TContext : BaseContext
{
private ServiceDescriptor? _descriptor;
- private readonly List _filters = new();
+ private readonly List _filters = [];
private int _order;
private OpenIddictServerHandlerType _type;
diff --git a/src/OpenIddict.Server/OpenIddictServerHandlers.Authentication.cs b/src/OpenIddict.Server/OpenIddictServerHandlers.Authentication.cs
index 1be1dacc..05ab72e2 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; } = ImmutableArray.Create(
+ public static ImmutableArray DefaultHandlers { get; } = [
/*
* Authorization request top-level processing:
*/
@@ -64,7 +64,8 @@ public static partial class OpenIddictServerHandlers
AttachRedirectUri.Descriptor,
InferResponseMode.Descriptor,
AttachResponseState.Descriptor,
- AttachIssuer.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 a99662ea..42a613d9 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; } = ImmutableArray.Create(
+ public static ImmutableArray DefaultHandlers { get; } = [
/*
* Device request top-level processing:
*/
@@ -60,7 +60,8 @@ public static partial class OpenIddictServerHandlers
/*
* Verification request handling:
*/
- AttachUserCodePrincipal.Descriptor);
+ 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 a2284d95..4aaaf6ab 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; } = ImmutableArray.Create(
+ public static ImmutableArray DefaultHandlers { get; } = [
/*
* Configuration request top-level processing:
*/
@@ -56,7 +56,8 @@ public static partial class OpenIddictServerHandlers
/*
* Cryptography request handling:
*/
- AttachSigningKeys.Descriptor);
+ 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 2f3ac729..97f493c6 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; } = ImmutableArray.Create(
+ public static ImmutableArray DefaultHandlers { get; } = [
/*
* Token request top-level processing:
*/
@@ -64,7 +64,8 @@ public static partial class OpenIddictServerHandlers
/*
* Token response handling:
*/
- NormalizeErrorResponse.Descriptor);
+ 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 8aa52250..85169f24 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; } = ImmutableArray.Create(
+ public static ImmutableArray DefaultHandlers { get; } = [
/*
* Introspection request top-level processing:
*/
@@ -51,7 +51,8 @@ public static partial class OpenIddictServerHandlers
/*
* Introspection response handling:
*/
- NormalizeErrorResponse.Descriptor);
+ 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 c4947b5b..1604918a 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; } = ImmutableArray.Create(
+ public static ImmutableArray DefaultHandlers { get; } = [
/*
* Token validation:
*/
@@ -44,7 +44,8 @@ public static partial class OpenIddictServerHandlers
CreateTokenEntry.Descriptor,
GenerateIdentityModelToken.Descriptor,
AttachTokenPayload.Descriptor,
- BeautifyToken.Descriptor);
+ BeautifyToken.Descriptor
+ ];
///
/// Contains the logic responsible for resolving the validation parameters used to validate tokens.
@@ -159,23 +160,23 @@ public static partial class OpenIddictServerHandlers
// If the issuer URI doesn't contain any query/fragment, allow both http://www.fabrikam.com
// and http://www.fabrikam.com/ (the recommended URI representation) to be considered valid.
// See https://datatracker.ietf.org/doc/html/rfc3986#section-6.2.3 for more information.
- { AbsolutePath: "/", Query.Length: 0, Fragment.Length: 0 } uri => new[]
- {
+ { AbsolutePath: "/", Query.Length: 0, Fragment.Length: 0 } uri =>
+ [
uri.AbsoluteUri, // Uri.AbsoluteUri is normalized and always contains a trailing slash.
uri.AbsoluteUri[..^1]
- },
+ ],
// When properly normalized, Uri.AbsolutePath should never be empty and should at least
// contain a leading slash. While dangerous, System.Uri now offers a way to create a URI
// instance without applying the default canonicalization logic. To support such URIs,
// a special case is added here to add back the missing trailing slash when necessary.
- { AbsolutePath.Length: 0, Query.Length: 0, Fragment.Length: 0 } uri => new[]
- {
+ { AbsolutePath.Length: 0, Query.Length: 0, Fragment.Length: 0 } uri =>
+ [
uri.AbsoluteUri,
uri.AbsoluteUri + "/"
- },
+ ],
- Uri uri => new[] { uri.AbsoluteUri }
+ Uri uri => [uri.AbsoluteUri]
};
parameters.ValidateIssuer = parameters.ValidIssuers is not null;
@@ -187,33 +188,33 @@ public static partial class OpenIddictServerHandlers
0 => null,
// Otherwise, map the token types to their JWT public or internal representation.
- _ => context.ValidTokenTypes.SelectMany(type => type switch
+ _ => context.ValidTokenTypes.SelectMany(type =>type switch
{
// For access tokens, both "at+jwt" and "application/at+jwt" are valid.
- TokenTypeHints.AccessToken => new[]
- {
+ TokenTypeHints.AccessToken =>
+ [
JsonWebTokenTypes.AccessToken,
JsonWebTokenTypes.Prefixes.Application + JsonWebTokenTypes.AccessToken
- },
+ ],
// For identity tokens, both "JWT" and "application/jwt" are valid.
- TokenTypeHints.IdToken => new[]
- {
+ TokenTypeHints.IdToken =>
+ [
JsonWebTokenTypes.Jwt,
JsonWebTokenTypes.Prefixes.Application + JsonWebTokenTypes.Jwt
- },
+ ],
// For authorization codes, only the short "oi_auc+jwt" form is valid.
- TokenTypeHints.AuthorizationCode => new[] { JsonWebTokenTypes.Private.AuthorizationCode },
+ TokenTypeHints.AuthorizationCode => [JsonWebTokenTypes.Private.AuthorizationCode],
// For device codes, only the short "oi_dvc+jwt" form is valid.
- TokenTypeHints.DeviceCode => new[] { JsonWebTokenTypes.Private.DeviceCode },
+ TokenTypeHints.DeviceCode => [JsonWebTokenTypes.Private.DeviceCode],
// For refresh tokens, only the short "oi_reft+jwt" form is valid.
- TokenTypeHints.RefreshToken => new[] { JsonWebTokenTypes.Private.RefreshToken },
+ TokenTypeHints.RefreshToken => [JsonWebTokenTypes.Private.RefreshToken],
// For user codes, only the short "oi_usrc+jwt" form is valid.
- TokenTypeHints.UserCode => new[] { JsonWebTokenTypes.Private.UserCode },
+ TokenTypeHints.UserCode => [JsonWebTokenTypes.Private.UserCode],
_ => throw new InvalidOperationException(SR.GetResourceString(SR.ID0003))
})
diff --git a/src/OpenIddict.Server/OpenIddictServerHandlers.Revocation.cs b/src/OpenIddict.Server/OpenIddictServerHandlers.Revocation.cs
index 9753d1f5..ea8ba325 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; } = ImmutableArray.Create(
+ public static ImmutableArray DefaultHandlers { get; } = [
/*
* Revocation request top-level processing:
*/
@@ -44,7 +44,8 @@ public static partial class OpenIddictServerHandlers
/*
* Revocation response handling:
*/
- NormalizeErrorResponse.Descriptor);
+ 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 6ff8c03a..a8f00526 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; } = ImmutableArray.Create(
+ public static ImmutableArray DefaultHandlers { get; } = [
/*
* Logout request top-level processing:
*/
@@ -47,7 +47,8 @@ public static partial class OpenIddictServerHandlers
* Logout response processing:
*/
AttachPostLogoutRedirectUri.Descriptor,
- AttachResponseState.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 bf4b5252..cae54df5 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; } = ImmutableArray.Create(
+ public static ImmutableArray DefaultHandlers { get; } = [
/*
* Userinfo request top-level processing:
*/
@@ -37,7 +37,8 @@ public static partial class OpenIddictServerHandlers
*/
AttachPrincipal.Descriptor,
AttachAudiences.Descriptor,
- AttachClaims.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 0a598771..5b60c2d6 100644
--- a/src/OpenIddict.Server/OpenIddictServerHandlers.cs
+++ b/src/OpenIddict.Server/OpenIddictServerHandlers.cs
@@ -21,7 +21,7 @@ namespace OpenIddict.Server;
[EditorBrowsable(EditorBrowsableState.Never)]
public static partial class OpenIddictServerHandlers
{
- public static ImmutableArray DefaultHandlers { get; } = ImmutableArray.Create(
+ public static ImmutableArray DefaultHandlers { get; } = [
/*
* Top-level request processing:
*/
@@ -103,17 +103,18 @@ public static partial class OpenIddictServerHandlers
* Error processing:
*/
AttachErrorParameters.Descriptor,
- AttachCustomErrorParameters.Descriptor)
-
- .AddRange(Authentication.DefaultHandlers)
- .AddRange(Device.DefaultHandlers)
- .AddRange(Discovery.DefaultHandlers)
- .AddRange(Exchange.DefaultHandlers)
- .AddRange(Introspection.DefaultHandlers)
- .AddRange(Protection.DefaultHandlers)
- .AddRange(Revocation.DefaultHandlers)
- .AddRange(Session.DefaultHandlers)
- .AddRange(Userinfo.DefaultHandlers);
+ AttachCustomErrorParameters.Descriptor,
+
+ ..Authentication.DefaultHandlers,
+ ..Device.DefaultHandlers,
+ ..Discovery.DefaultHandlers,
+ ..Exchange.DefaultHandlers,
+ ..Introspection.DefaultHandlers,
+ ..Protection.DefaultHandlers,
+ ..Revocation.DefaultHandlers,
+ ..Session.DefaultHandlers,
+ ..Userinfo.DefaultHandlers
+ ];
///
/// Contains the logic responsible for inferring the endpoint type from the request URI.
diff --git a/src/OpenIddict.Server/OpenIddictServerOptions.cs b/src/OpenIddict.Server/OpenIddictServerOptions.cs
index bc74f3f1..794ebf5d 100644
--- a/src/OpenIddict.Server/OpenIddictServerOptions.cs
+++ b/src/OpenIddict.Server/OpenIddictServerOptions.cs
@@ -37,7 +37,7 @@ public sealed class OpenIddictServerOptions
/// - X.509 keys whose backing certificate is not yet valid are never preferred.
///
///
- public List EncryptionCredentials { get; } = new();
+ public List EncryptionCredentials { get; } = [];
///
/// Gets the list of signing credentials used by the OpenIddict server services.
@@ -55,64 +55,64 @@ public sealed class OpenIddictServerOptions
/// - X.509 keys whose backing certificate is not yet valid are never preferred.
///
///
- public List SigningCredentials { get; } = new();
+ public List SigningCredentials { get; } = [];
///
/// Gets the absolute and relative URIs associated to the authorization endpoint.
///
- public List AuthorizationEndpointUris { get; } = new();
+ public List AuthorizationEndpointUris { get; } = [];
///
/// Gets the absolute and relative URIs associated to the configuration endpoint.
///
- public List ConfigurationEndpointUris { get; } = new()
- {
+ public List ConfigurationEndpointUris { get; } =
+ [
new Uri(".well-known/openid-configuration", UriKind.Relative),
new Uri(".well-known/oauth-authorization-server", UriKind.Relative)
- };
+ ];
///
/// Gets the absolute and relative URIs associated to the cryptography endpoint.
///
- public List CryptographyEndpointUris { get; } = new()
- {
+ public List CryptographyEndpointUris { get; } =
+ [
new Uri(".well-known/jwks", UriKind.Relative)
- };
+ ];
///
/// Gets the absolute and relative URIs associated to the device endpoint.
///
- public List DeviceEndpointUris { get; } = new();
+ public List DeviceEndpointUris { get; } = [];
///
/// Gets the absolute and relative URIs associated to the introspection endpoint.
///
- public List IntrospectionEndpointUris { get; } = new();
+ public List IntrospectionEndpointUris { get; } = [];
///
/// Gets the absolute and relative URIs associated to the logout endpoint.
///
- public List LogoutEndpointUris { get; } = new();
+ public List LogoutEndpointUris { get; } = [];
///
/// Gets the absolute and relative URIs associated to the revocation endpoint.
///
- public List RevocationEndpointUris { get; } = new();
+ public List RevocationEndpointUris { get; } = [];
///
/// Gets the absolute and relative URIs associated to the token endpoint.
///
- public List TokenEndpointUris { get; } = new();
+ public List TokenEndpointUris { get; } = [];
///
/// Gets the absolute and relative URIs associated to the userinfo endpoint.
///
- public List UserinfoEndpointUris { get; } = new();
+ public List UserinfoEndpointUris { get; } = [];
///
/// Gets the absolute and relative URIs associated to the verification endpoint.
///
- public List VerificationEndpointUris { get; } = new();
+ public List VerificationEndpointUris { get; } = [];
///
/// Gets or sets the JWT handler used to protect and unprotect tokens.
diff --git a/src/OpenIddict.Validation.AspNetCore/OpenIddictValidationAspNetCoreHandlers.cs b/src/OpenIddict.Validation.AspNetCore/OpenIddictValidationAspNetCoreHandlers.cs
index 5cec0c92..7c210e62 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; } = ImmutableArray.Create(
+ public static ImmutableArray DefaultHandlers { get; } = [
/*
* Request top-level processing:
*/
@@ -57,7 +57,8 @@ public static partial class OpenIddictValidationAspNetCoreHandlers
AttachHttpResponseCode.Descriptor,
AttachCacheControlHeader.Descriptor,
AttachWwwAuthenticateHeader.Descriptor,
- ProcessChallengeErrorResponse.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/OpenIddict.Validation.DataProtection.csproj b/src/OpenIddict.Validation.DataProtection/OpenIddict.Validation.DataProtection.csproj
index 595448ec..916bb234 100644
--- a/src/OpenIddict.Validation.DataProtection/OpenIddict.Validation.DataProtection.csproj
+++ b/src/OpenIddict.Validation.DataProtection/OpenIddict.Validation.DataProtection.csproj
@@ -29,10 +29,6 @@
-
-
-
-
diff --git a/src/OpenIddict.Validation.DataProtection/OpenIddictValidationDataProtectionHandlers.Protection.cs b/src/OpenIddict.Validation.DataProtection/OpenIddictValidationDataProtectionHandlers.Protection.cs
index 515e475b..f9670544 100644
--- a/src/OpenIddict.Validation.DataProtection/OpenIddictValidationDataProtectionHandlers.Protection.cs
+++ b/src/OpenIddict.Validation.DataProtection/OpenIddictValidationDataProtectionHandlers.Protection.cs
@@ -21,11 +21,12 @@ public static partial class OpenIddictValidationDataProtectionHandlers
{
public static class Protection
{
- public static ImmutableArray DefaultHandlers { get; } = ImmutableArray.Create(
+ public static ImmutableArray DefaultHandlers { get; } = [
/*
* Token validation:
*/
- ValidateDataProtectionToken.Descriptor);
+ ValidateDataProtectionToken.Descriptor
+ ];
///
/// Contains the logic responsible for validating tokens generated using Data Protection.
@@ -118,9 +119,9 @@ public static partial class OpenIddictValidationDataProtectionHandlers
(type, context.IsReferenceToken) switch
{
(TokenTypeHints.AccessToken, true)
- => new[] { Handlers.Server, Formats.AccessToken, Features.ReferenceTokens, Schemes.Server },
+ => [Handlers.Server, Formats.AccessToken, Features.ReferenceTokens, Schemes.Server],
(TokenTypeHints.AccessToken, false)
- => new[] { Handlers.Server, Formats.AccessToken, Schemes.Server },
+ => [Handlers.Server, Formats.AccessToken, Schemes.Server],
_ => throw new InvalidOperationException(SR.GetResourceString(SR.ID0003))
});
diff --git a/src/OpenIddict.Validation.DataProtection/OpenIddictValidationDataProtectionHandlers.cs b/src/OpenIddict.Validation.DataProtection/OpenIddictValidationDataProtectionHandlers.cs
index 76dcd326..2b7a38c3 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; }
- = ImmutableArray.CreateRange(Protection.DefaultHandlers);
+ = [..Protection.DefaultHandlers];
}
diff --git a/src/OpenIddict.Validation.Owin/OpenIddict.Validation.Owin.csproj b/src/OpenIddict.Validation.Owin/OpenIddict.Validation.Owin.csproj
index acd47fd0..df6bb372 100644
--- a/src/OpenIddict.Validation.Owin/OpenIddict.Validation.Owin.csproj
+++ b/src/OpenIddict.Validation.Owin/OpenIddict.Validation.Owin.csproj
@@ -18,10 +18,6 @@
-
-
-
-
diff --git a/src/OpenIddict.Validation.Owin/OpenIddictValidationOwinHandlers.cs b/src/OpenIddict.Validation.Owin/OpenIddictValidationOwinHandlers.cs
index c7ef20ad..9d116c67 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; } = ImmutableArray.Create(
+ public static ImmutableArray DefaultHandlers { get; } = [
/*
* Request top-level processing:
*/
@@ -56,7 +56,8 @@ public static partial class OpenIddictValidationOwinHandlers
SuppressFormsAuthenticationRedirect.Descriptor,
AttachCacheControlHeader.Descriptor,
AttachWwwAuthenticateHeader.Descriptor,
- ProcessChallengeErrorResponse.Descriptor);
+ ProcessChallengeErrorResponse.Descriptor
+ ];
///
/// Contains the logic responsible for resolving the request URI from the OWIN environment.
@@ -540,7 +541,7 @@ public static partial class OpenIddictValidationOwinHandlers
response.Context.Authentication.AuthenticationResponseChallenge is null)
{
response.Context.Authentication.AuthenticationResponseChallenge =
- new AuthenticationResponseChallenge(new[] { Guid.NewGuid().ToString() }, null);
+ new AuthenticationResponseChallenge([Guid.NewGuid().ToString()], null);
}
return default;
diff --git a/src/OpenIddict.Validation.SystemNetHttp/OpenIddict.Validation.SystemNetHttp.csproj b/src/OpenIddict.Validation.SystemNetHttp/OpenIddict.Validation.SystemNetHttp.csproj
index f5b9018b..7063d908 100644
--- a/src/OpenIddict.Validation.SystemNetHttp/OpenIddict.Validation.SystemNetHttp.csproj
+++ b/src/OpenIddict.Validation.SystemNetHttp/OpenIddict.Validation.SystemNetHttp.csproj
@@ -42,10 +42,6 @@
-
-
-
-
diff --git a/src/OpenIddict.Validation.SystemNetHttp/OpenIddictValidationSystemNetHttpHandlers.Discovery.cs b/src/OpenIddict.Validation.SystemNetHttp/OpenIddictValidationSystemNetHttpHandlers.Discovery.cs
index bc7b7522..5c8cc5d7 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; } = ImmutableArray.Create(
+ public static ImmutableArray DefaultHandlers { get; } = [
/*
* Configuration request processing:
*/
@@ -55,6 +55,7 @@ public static partial class OpenIddictValidationSystemNetHttpHandlers
ExtractJsonHttpResponse.Descriptor,
ExtractWwwAuthenticateHeader.Descriptor,
ValidateHttpResponse.Descriptor,
- DisposeHttpResponse.Descriptor);
+ DisposeHttpResponse.Descriptor
+ ];
}
}
diff --git a/src/OpenIddict.Validation.SystemNetHttp/OpenIddictValidationSystemNetHttpHandlers.Introspection.cs b/src/OpenIddict.Validation.SystemNetHttp/OpenIddictValidationSystemNetHttpHandlers.Introspection.cs
index e3d48fc1..3ef6afb0 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; } = ImmutableArray.Create(
+ public static ImmutableArray DefaultHandlers { get; } = [
/*
* Introspection request processing:
*/
@@ -38,7 +38,8 @@ public static partial class OpenIddictValidationSystemNetHttpHandlers
ExtractJsonHttpResponse.Descriptor,
ExtractWwwAuthenticateHeader.Descriptor,
ValidateHttpResponse.Descriptor,
- DisposeHttpResponse.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 50fc1bf8..5d63f299 100644
--- a/src/OpenIddict.Validation.SystemNetHttp/OpenIddictValidationSystemNetHttpHandlers.cs
+++ b/src/OpenIddict.Validation.SystemNetHttp/OpenIddictValidationSystemNetHttpHandlers.cs
@@ -22,9 +22,7 @@ namespace OpenIddict.Validation.SystemNetHttp;
public static partial class OpenIddictValidationSystemNetHttpHandlers
{
public static ImmutableArray DefaultHandlers { get; }
- = ImmutableArray.Create()
- .AddRange(Discovery.DefaultHandlers)
- .AddRange(Introspection.DefaultHandlers);
+ = [..Discovery.DefaultHandlers, ..Introspection.DefaultHandlers];
///
/// Contains the logic responsible for creating and attaching a .
diff --git a/src/OpenIddict.Validation.SystemNetHttp/OpenIddictValidationSystemNetHttpOptions.cs b/src/OpenIddict.Validation.SystemNetHttp/OpenIddictValidationSystemNetHttpOptions.cs
index aa2b3a12..86f17b57 100644
--- a/src/OpenIddict.Validation.SystemNetHttp/OpenIddictValidationSystemNetHttpOptions.cs
+++ b/src/OpenIddict.Validation.SystemNetHttp/OpenIddictValidationSystemNetHttpOptions.cs
@@ -42,11 +42,11 @@ public sealed class OpenIddictValidationSystemNetHttpOptions
/// Gets the user-defined actions used to amend the
/// instances created by the OpenIddict validation/System.Net.Http integration.
///
- public List> HttpClientActions { get; } = new();
+ public List> HttpClientActions { get; } = [];
///
/// Gets the user-defined actions used to amend the
/// instances created by the OpenIddict validation/System.Net.Http integration.
///
- public List> HttpClientHandlerActions { get; } = new();
+ public List> HttpClientHandlerActions { get; } = [];
}
diff --git a/src/OpenIddict.Validation/OpenIddict.Validation.csproj b/src/OpenIddict.Validation/OpenIddict.Validation.csproj
index 345afe44..99c49d2f 100644
--- a/src/OpenIddict.Validation/OpenIddict.Validation.csproj
+++ b/src/OpenIddict.Validation/OpenIddict.Validation.csproj
@@ -26,10 +26,6 @@ To use the validation feature on ASP.NET Core or OWIN/Katana, reference the Open
-
-
-
-
diff --git a/src/OpenIddict.Validation/OpenIddictValidationHandlerDescriptor.cs b/src/OpenIddict.Validation/OpenIddictValidationHandlerDescriptor.cs
index d791f34c..09d72bb9 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; } = ImmutableArray.Create();
+ public ImmutableArray FilterTypes { get; private set; } = [];
///
/// Gets the order assigned to the handler.
@@ -63,7 +63,7 @@ public sealed class OpenIddictValidationHandlerDescriptor
public sealed class Builder where TContext : BaseContext
{
private ServiceDescriptor? _descriptor;
- private readonly List _filters = new();
+ private readonly List _filters = [];
private int _order;
private OpenIddictValidationHandlerType _type;
diff --git a/src/OpenIddict.Validation/OpenIddictValidationHandlers.Discovery.cs b/src/OpenIddict.Validation/OpenIddictValidationHandlers.Discovery.cs
index e393c1f7..406aea70 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; } = ImmutableArray.Create(
+ public static ImmutableArray DefaultHandlers { get; } = [
/*
* Configuration response handling:
*/
@@ -31,7 +31,8 @@ public static partial class OpenIddictValidationHandlers
*/
ValidateWellKnownCryptographyParameters.Descriptor,
HandleCryptographyErrorResponse.Descriptor,
- ExtractSigningKeys.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 209888c9..c69f37c5 100644
--- a/src/OpenIddict.Validation/OpenIddictValidationHandlers.Introspection.cs
+++ b/src/OpenIddict.Validation/OpenIddictValidationHandlers.Introspection.cs
@@ -15,7 +15,7 @@ public static partial class OpenIddictValidationHandlers
{
public static class Introspection
{
- public static ImmutableArray DefaultHandlers { get; } = ImmutableArray.Create(
+ public static ImmutableArray DefaultHandlers { get; } = [
/*
* Introspection response handling:
*/
@@ -24,7 +24,8 @@ public static partial class OpenIddictValidationHandlers
HandleInactiveResponse.Descriptor,
ValidateIssuer.Descriptor,
ValidateTokenUsage.Descriptor,
- PopulateClaims.Descriptor);
+ PopulateClaims.Descriptor
+ ];
///
/// Contains the logic responsible for validating the well-known parameters contained in the introspection response.
diff --git a/src/OpenIddict.Validation/OpenIddictValidationHandlers.Protection.cs b/src/OpenIddict.Validation/OpenIddictValidationHandlers.Protection.cs
index 74e7a187..687e5b75 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; } = ImmutableArray.Create(
+ public static ImmutableArray DefaultHandlers { get; } = [
/*
* Token validation:
*/
@@ -37,7 +37,8 @@ public static partial class OpenIddictValidationHandlers
* Token generation:
*/
AttachSecurityCredentials.Descriptor,
- GenerateIdentityModelToken.Descriptor);
+ GenerateIdentityModelToken.Descriptor
+ ];
///
/// Contains the logic responsible for resolving the validation parameters used to validate tokens.
@@ -78,23 +79,23 @@ public static partial class OpenIddictValidationHandlers
// If the issuer URI doesn't contain any query/fragment, allow both http://www.fabrikam.com
// and http://www.fabrikam.com/ (the recommended URI representation) to be considered valid.
// See https://datatracker.ietf.org/doc/html/rfc3986#section-6.2.3 for more information.
- { AbsolutePath: "/", Query.Length: 0, Fragment.Length: 0 } uri => new[]
- {
+ { AbsolutePath: "/", Query.Length: 0, Fragment.Length: 0 } uri =>
+ [
uri.AbsoluteUri, // Uri.AbsoluteUri is normalized and always contains a trailing slash.
uri.AbsoluteUri[..^1]
- },
+ ],
// When properly normalized, Uri.AbsolutePath should never be empty and should at least
// contain a leading slash. While dangerous, System.Uri now offers a way to create a URI
// instance without applying the default canonicalization logic. To support such URIs,
// a special case is added here to add back the missing trailing slash when necessary.
- { AbsolutePath.Length: 0, Query.Length: 0, Fragment.Length: 0 } uri => new[]
- {
+ { AbsolutePath.Length: 0, Query.Length: 0, Fragment.Length: 0 } uri =>
+ [
uri.AbsoluteUri,
uri.AbsoluteUri + "/"
- },
+ ],
- Uri uri => new[] { uri.AbsoluteUri }
+ Uri uri => [uri.AbsoluteUri]
};
parameters.ValidateIssuer = parameters.ValidIssuers is not null;
diff --git a/src/OpenIddict.Validation/OpenIddictValidationHandlers.cs b/src/OpenIddict.Validation/OpenIddictValidationHandlers.cs
index b3fb5f63..3730ec2a 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; } = ImmutableArray.Create(
+ public static ImmutableArray DefaultHandlers { get; } = [
/*
* Authentication processing:
*/
@@ -46,11 +46,12 @@ public static partial class OpenIddictValidationHandlers
* Error processing:
*/
AttachErrorParameters.Descriptor,
- AttachCustomErrorParameters.Descriptor)
+ AttachCustomErrorParameters.Descriptor,
- .AddRange(Discovery.DefaultHandlers)
- .AddRange(Introspection.DefaultHandlers)
- .AddRange(Protection.DefaultHandlers);
+ ..Discovery.DefaultHandlers,
+ ..Introspection.DefaultHandlers,
+ ..Protection.DefaultHandlers
+ ];
///
/// Contains the logic responsible for selecting the token types that should be validated.
diff --git a/src/OpenIddict.Validation/OpenIddictValidationOptions.cs b/src/OpenIddict.Validation/OpenIddictValidationOptions.cs
index 81fca6e3..5590c948 100644
--- a/src/OpenIddict.Validation/OpenIddictValidationOptions.cs
+++ b/src/OpenIddict.Validation/OpenIddictValidationOptions.cs
@@ -29,7 +29,7 @@ public sealed class OpenIddictValidationOptions
/// - X.509 keys whose backing certificate is not yet valid are never preferred.
///
///
- public List EncryptionCredentials { get; } = new();
+ public List EncryptionCredentials { get; } = [];
///
/// Gets the list of signing credentials used by the OpenIddict validation services.
@@ -47,7 +47,7 @@ public sealed class OpenIddictValidationOptions
/// - X.509 keys whose backing certificate is not yet valid are never preferred.
///
///
- public List SigningCredentials { get; } = new();
+ public List SigningCredentials { get; } = [];
///
/// Gets or sets the period of time client assertions remain valid after being issued. The default value is 5 minutes.
diff --git a/src/OpenIddict/OpenIddict.csproj b/src/OpenIddict/OpenIddict.csproj
index 0dd2628e..28ca0b5a 100644
--- a/src/OpenIddict/OpenIddict.csproj
+++ b/src/OpenIddict/OpenIddict.csproj
@@ -9,6 +9,7 @@
false
false
+ false
true
diff --git a/test/OpenIddict.Abstractions.Tests/Primitives/OpenIddictExtensionsTests.cs b/test/OpenIddict.Abstractions.Tests/Primitives/OpenIddictExtensionsTests.cs
index 124ef251..87d5cc08 100644
--- a/test/OpenIddict.Abstractions.Tests/Primitives/OpenIddictExtensionsTests.cs
+++ b/test/OpenIddict.Abstractions.Tests/Primitives/OpenIddictExtensionsTests.cs
@@ -1125,8 +1125,8 @@ public class OpenIddictExtensionsTests
// Assert
Assert.Equal(2, destinations.Count);
- Assert.Equal(new[] { Destinations.AccessToken, Destinations.IdentityToken }, destinations[Claims.Name]);
- Assert.Equal(new[] { Destinations.IdentityToken }, destinations[Claims.Email]);
+ Assert.Equal([Destinations.AccessToken, Destinations.IdentityToken], destinations[Claims.Name]);
+ Assert.Equal([Destinations.IdentityToken], destinations[Claims.Email]);
}
[Fact]
@@ -1159,8 +1159,8 @@ public class OpenIddictExtensionsTests
// Assert
Assert.Equal(2, destinations.Count);
- Assert.Equal(new[] { Destinations.AccessToken, Destinations.IdentityToken }, destinations[Claims.Name]);
- Assert.Equal(new[] { Destinations.IdentityToken }, destinations[Claims.Email]);
+ Assert.Equal([Destinations.AccessToken, Destinations.IdentityToken], destinations[Claims.Name]);
+ Assert.Equal([Destinations.IdentityToken], destinations[Claims.Email]);
}
[Fact]
@@ -1227,9 +1227,9 @@ public class OpenIddictExtensionsTests
var identity = new ClaimsIdentity(claims);
var destinations = ImmutableDictionary.CreateBuilder(StringComparer.Ordinal);
- destinations.Add(Claims.Name, new[] { Destinations.AccessToken, Destinations.IdentityToken });
- destinations.Add(Claims.Email, new[] { Destinations.IdentityToken });
- destinations.Add(Claims.Nonce, Array.Empty());
+ destinations.Add(Claims.Name, [Destinations.AccessToken, Destinations.IdentityToken]);
+ destinations.Add(Claims.Email, [Destinations.IdentityToken]);
+ destinations.Add(Claims.Nonce, []);
// Act
identity.SetDestinations(destinations.ToImmutable());
@@ -1254,9 +1254,9 @@ public class OpenIddictExtensionsTests
var principal = new ClaimsPrincipal(new ClaimsIdentity(claims));
var destinations = ImmutableDictionary.CreateBuilder(StringComparer.Ordinal);
- destinations.Add(Claims.Name, new[] { Destinations.AccessToken, Destinations.IdentityToken });
- destinations.Add(Claims.Email, new[] { Destinations.IdentityToken });
- destinations.Add(Claims.Nonce, Array.Empty());
+ destinations.Add(Claims.Name, [Destinations.AccessToken, Destinations.IdentityToken]);
+ destinations.Add(Claims.Email, [Destinations.IdentityToken]);
+ destinations.Add(Claims.Nonce, []);
// Act
principal.SetDestinations(destinations.ToImmutable());
@@ -1333,10 +1333,10 @@ public class OpenIddictExtensionsTests
// Act
identity.SetDestinations(claim => claim.Type switch
{
- Claims.Name => new[] { Destinations.AccessToken, Destinations.IdentityToken },
- Claims.Email => new[] { Destinations.IdentityToken },
+ Claims.Name => [Destinations.AccessToken, Destinations.IdentityToken],
+ Claims.Email => [Destinations.IdentityToken],
- _ => Array.Empty()
+ _ => []
});
// Assert
@@ -1361,10 +1361,10 @@ public class OpenIddictExtensionsTests
// Act
principal.SetDestinations(claim => claim.Type switch
{
- Claims.Name => new[] { Destinations.AccessToken, Destinations.IdentityToken },
- Claims.Email => new[] { Destinations.IdentityToken },
+ Claims.Name => [Destinations.AccessToken, Destinations.IdentityToken],
+ Claims.Email => [Destinations.IdentityToken],
- _ => Array.Empty()
+ _ => []
});
// Assert
@@ -2084,7 +2084,7 @@ public class OpenIddictExtensionsTests
var identity = (ClaimsIdentity) null!;
// Act and assert
- var exception = Assert.Throws(() => identity.AddClaims("type", ImmutableArray.Create()));
+ var exception = Assert.Throws(() => identity.AddClaims("type", []));
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", ImmutableArray.Create()));
+ var exception = Assert.Throws(() => principal.AddClaims("type", []));
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", ImmutableArray.Create("value1", "value2")));
+ var exception = Assert.Throws(() => principal.AddClaims("type", ["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, ImmutableArray.Create()));
+ var exception = Assert.Throws(() => identity.AddClaims(type, []));
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, ImmutableArray.Create()));
+ var exception = Assert.Throws(() => principal.AddClaims(type, []));
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", ImmutableArray.Create("value1", "value2"), "issuer");
+ identity.AddClaims("type", ["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", ImmutableArray.Create("value1", "value2"), "issuer");
+ principal.AddClaims("type", ["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", ImmutableArray.Create("value1", "value2"));
+ identity.AddClaims("TYPE", ["value1", "value2"]);
// Assert
- Assert.Equal(ImmutableArray.Create("value1", "value2"), identity.GetClaims("type"));
+ Assert.Equal(["value1", "value2"], identity.GetClaims("type"));
}
[Fact]
@@ -2204,10 +2204,10 @@ public class OpenIddictExtensionsTests
var principal = new ClaimsPrincipal(new ClaimsIdentity());
// Act
- principal.AddClaims("TYPE", ImmutableArray.Create("value1", "value2"));
+ principal.AddClaims("TYPE", ["value1", "value2"]);
// Assert
- Assert.Equal(ImmutableArray.Create("value1", "value2"), principal.GetClaims("type"));
+ Assert.Equal(["value1", "value2"], principal.GetClaims("type"));
}
[Fact]
@@ -2366,7 +2366,7 @@ public class OpenIddictExtensionsTests
identity.AddClaims("TYPE", JsonSerializer.Deserialize(@"[""Fabrikam"",""Contoso""]"));
// Assert
- Assert.Equal(ImmutableArray.Create("Fabrikam", "Contoso"), identity.GetClaims("type"));
+ Assert.Equal(["Fabrikam", "Contoso"], identity.GetClaims("type"));
}
[Fact]
@@ -2379,7 +2379,7 @@ public class OpenIddictExtensionsTests
principal.AddClaims("TYPE", JsonSerializer.Deserialize(@"[""Fabrikam"",""Contoso""]"));
// Assert
- Assert.Equal(ImmutableArray.Create("Fabrikam", "Contoso"), principal.GetClaims("type"));
+ Assert.Equal(["Fabrikam", "Contoso"], principal.GetClaims("type"));
}
[Fact]
@@ -2540,7 +2540,7 @@ public class OpenIddictExtensionsTests
identity.AddClaim(new Claim(Claims.Scope, Scopes.Profile));
// Act and assert
- Assert.Equal(new[] { Scopes.OpenId, Scopes.Profile }, identity.GetClaims(Claims.Scope));
+ Assert.Equal([Scopes.OpenId, Scopes.Profile], identity.GetClaims(Claims.Scope), StringComparer.Ordinal);
}
[Fact]
@@ -2555,7 +2555,7 @@ public class OpenIddictExtensionsTests
var principal = new ClaimsPrincipal(identity);
// Act and assert
- Assert.Equal(new[] { Scopes.OpenId, Scopes.Profile }, principal.GetClaims(Claims.Scope));
+ Assert.Equal([Scopes.OpenId, Scopes.Profile], principal.GetClaims(Claims.Scope), StringComparer.Ordinal);
}
[Fact]
@@ -3578,7 +3578,7 @@ public class OpenIddictExtensionsTests
var identity = (ClaimsIdentity) null!;
// Act and assert
- var exception = Assert.Throws(() => identity.SetClaims("type", ImmutableArray.Create()));
+ var exception = Assert.Throws(() => identity.SetClaims("type", []));
Assert.Equal("identity", exception.ParamName);
}
@@ -3590,7 +3590,7 @@ public class OpenIddictExtensionsTests
var principal = (ClaimsPrincipal) null!;
// Act and assert
- var exception = Assert.Throws(() => principal.SetClaims("type", ImmutableArray.Create()));
+ var exception = Assert.Throws(() => principal.SetClaims("type", []));
Assert.Equal("principal", exception.ParamName);
}
@@ -3602,7 +3602,7 @@ public class OpenIddictExtensionsTests
var principal = new ClaimsPrincipal();
// Act and assert
- var exception = Assert.Throws(() => principal.SetClaims("type", ImmutableArray.Create("value1", "value2")));
+ var exception = Assert.Throws(() => principal.SetClaims("type", ["value1", "value2"]));
Assert.Equal("principal", exception.ParamName);
Assert.StartsWith(SR.GetResourceString(SR.ID0286), exception.Message);
@@ -3617,7 +3617,7 @@ public class OpenIddictExtensionsTests
var identity = new ClaimsIdentity();
// Act and assert
- var exception = Assert.Throws(() => identity.SetClaims(type, ImmutableArray.Create()));
+ var exception = Assert.Throws(() => identity.SetClaims(type, []));
Assert.Equal("type", exception.ParamName);
Assert.StartsWith(SR.GetResourceString(SR.ID0184), exception.Message);
@@ -3632,7 +3632,7 @@ public class OpenIddictExtensionsTests
var principal = new ClaimsPrincipal(new ClaimsIdentity());
// Act and assert
- var exception = Assert.Throws(() => principal.SetClaims(type, ImmutableArray.Create()));
+ var exception = Assert.Throws(() => principal.SetClaims(type, []));
Assert.Equal("type", exception.ParamName);
Assert.StartsWith(SR.GetResourceString(SR.ID0184), exception.Message);
@@ -3645,7 +3645,7 @@ public class OpenIddictExtensionsTests
var identity = new ClaimsIdentity();
// Act
- identity.SetClaims("type", ImmutableArray.Create("value1", "value2"), "issuer");
+ identity.SetClaims("type", ["value1", "value2"], "issuer");
// Assert
var claims = identity.FindAll("type").ToArray();
@@ -3665,7 +3665,7 @@ public class OpenIddictExtensionsTests
var principal = new ClaimsPrincipal(new ClaimsIdentity());
// Act
- principal.SetClaims("type", ImmutableArray.Create("value1", "value2"), "issuer");
+ principal.SetClaims("type", ["value1", "value2"], "issuer");
// Assert
var claims = principal.FindAll("type").ToArray();
@@ -3684,10 +3684,10 @@ public class OpenIddictExtensionsTests
var identity = new ClaimsIdentity();
// Act
- identity.SetClaims("TYPE", ImmutableArray.Create("value1", "value2"));
+ identity.SetClaims("TYPE", ["value1", "value2"]);
// Assert
- Assert.Equal(ImmutableArray.Create("value1", "value2"), identity.GetClaims("type"));
+ Assert.Equal(["value1", "value2"], identity.GetClaims("type"));
}
[Fact]
@@ -3697,10 +3697,10 @@ public class OpenIddictExtensionsTests
var principal = new ClaimsPrincipal(new ClaimsIdentity());
// Act
- principal.SetClaims("TYPE", ImmutableArray.Create("value1", "value2"));
+ principal.SetClaims("TYPE", ["value1", "value2"]);
// Assert
- Assert.Equal(ImmutableArray.Create("value1", "value2"), principal.GetClaims("type"));
+ Assert.Equal(["value1", "value2"], principal.GetClaims("type"));
}
[Fact]
@@ -3711,7 +3711,7 @@ public class OpenIddictExtensionsTests
identity.AddClaim("type", "value");
// Act
- identity.SetClaims("type", ImmutableArray.Create());
+ identity.SetClaims("type", []);
// Assert
Assert.Empty(identity.GetClaims("type"));
@@ -3725,7 +3725,7 @@ public class OpenIddictExtensionsTests
principal.AddClaim("type", "value");
// Act
- principal.SetClaims("type", ImmutableArray.Create());
+ principal.SetClaims("type", []);
// Assert
Assert.Empty(principal.GetClaims("type"));
@@ -3848,7 +3848,7 @@ public class OpenIddictExtensionsTests
identity.SetClaims("TYPE", JsonSerializer.Deserialize(@"[""Fabrikam"",""Contoso""]"));
// Assert
- Assert.Equal(ImmutableArray.Create("Fabrikam", "Contoso"), identity.GetClaims("type"));
+ Assert.Equal(["Fabrikam", "Contoso"], identity.GetClaims("type"));
}
[Fact]
@@ -3861,7 +3861,7 @@ public class OpenIddictExtensionsTests
principal.SetClaims("TYPE", JsonSerializer.Deserialize(@"[""Fabrikam"",""Contoso""]"));
// Assert
- Assert.Equal(ImmutableArray.Create("Fabrikam", "Contoso"), principal.GetClaims("type"));
+ Assert.Equal(["Fabrikam", "Contoso"], principal.GetClaims("type"));
}
[Fact]
diff --git a/test/OpenIddict.Abstractions.Tests/Primitives/OpenIddictMessageTests.cs b/test/OpenIddict.Abstractions.Tests/Primitives/OpenIddictMessageTests.cs
index f5d5048d..c0332f22 100644
--- a/test/OpenIddict.Abstractions.Tests/Primitives/OpenIddictMessageTests.cs
+++ b/test/OpenIddict.Abstractions.Tests/Primitives/OpenIddictMessageTests.cs
@@ -101,7 +101,7 @@ public class OpenIddictMessageTests
// Assert
Assert.Equal(1, message.Count);
- Assert.Equal(new[] { "Fabrikam", "Contoso" }, (string[]?) message.GetParameter("parameter"));
+ Assert.Equal(["Fabrikam", "Contoso"], (string[]?) message.GetParameter("parameter"));
}
[Fact]
@@ -110,12 +110,12 @@ public class OpenIddictMessageTests
// Arrange and act
var message = new OpenIddictMessage(new[]
{
- new KeyValuePair("parameter", new[] { "Fabrikam", "Contoso" })
+ new KeyValuePair("parameter", ["Fabrikam", "Contoso"])
});
// Assert
Assert.Equal(1, message.Count);
- Assert.Equal(new[] { "Fabrikam", "Contoso" }, (string[]?) message.GetParameter("parameter"));
+ Assert.Equal(["Fabrikam", "Contoso"], (string[]?) message.GetParameter("parameter"));
}
[Fact]
@@ -124,7 +124,7 @@ public class OpenIddictMessageTests
// Arrange and act
var message = new OpenIddictMessage(new[]
{
- new KeyValuePair("parameter", new[] { "Fabrikam" })
+ new KeyValuePair("parameter", ["Fabrikam"])
});
// Assert
diff --git a/test/OpenIddict.Abstractions.Tests/Primitives/OpenIddictParameterTests.cs b/test/OpenIddict.Abstractions.Tests/Primitives/OpenIddictParameterTests.cs
index 40360453..fa543035 100644
--- a/test/OpenIddict.Abstractions.Tests/Primitives/OpenIddictParameterTests.cs
+++ b/test/OpenIddict.Abstractions.Tests/Primitives/OpenIddictParameterTests.cs
@@ -195,7 +195,7 @@ public class OpenIddictParameterTests
public void Equals_UsesSequenceEqualForArrays()
{
// Arrange
- var parameter = new OpenIddictParameter(new[] { "Fabrikam", "Contoso" });
+ var parameter = new OpenIddictParameter(["Fabrikam", "Contoso"]);
// Act and assert
Assert.True(parameter.Equals(new string[] { "Fabrikam", "Contoso" }));
@@ -530,7 +530,7 @@ public class OpenIddictParameterTests
@"[""Fabrikam"",""Contoso""]")).GetHashCode());
Assert.Equal(
- new OpenIddictParameter(new[] { "Fabrikam", "Contoso" }).GetHashCode(),
+ new OpenIddictParameter(["Fabrikam", "Contoso"]).GetHashCode(),
new OpenIddictParameter(JsonSerializer.Deserialize(
@"[""Fabrikam"",""Contoso""]")).GetHashCode());
@@ -541,7 +541,7 @@ public class OpenIddictParameterTests
@"[""Contoso"",""Fabrikam""]")).GetHashCode());
Assert.NotEqual(
- new OpenIddictParameter(new[] { "Fabrikam", "Contoso" }).GetHashCode(),
+ new OpenIddictParameter(["Fabrikam", "Contoso"]).GetHashCode(),
new OpenIddictParameter(JsonSerializer.Deserialize(
@"[""Contoso"",""Fabrikam""]")).GetHashCode());
}
@@ -1600,8 +1600,8 @@ public class OpenIddictParameterTests
public void BoolConverter_ReturnsDefaultValueForUnsupportedArrays()
{
// Arrange, act and assert
- Assert.False((bool) new OpenIddictParameter(new[] { "Fabrikam", "Contoso" }));
- Assert.Null((bool?) new OpenIddictParameter(new[] { "Fabrikam", "Contoso" }));
+ Assert.False((bool) new OpenIddictParameter(["Fabrikam", "Contoso"]));
+ Assert.Null((bool?) new OpenIddictParameter(["Fabrikam", "Contoso"]));
}
[Fact]
@@ -1737,7 +1737,7 @@ public class OpenIddictParameterTests
public void JsonElementConverter_CanConvertFromArrays()
{
// Arrange and act
- var array = (JsonElement) new OpenIddictParameter(new[] { "Contoso", "Fabrikam" });
+ var array = (JsonElement) new OpenIddictParameter(["Contoso", "Fabrikam"]);
// Assert
Assert.Equal(2, array.GetArrayLength());
@@ -1837,7 +1837,7 @@ public class OpenIddictParameterTests
public void JsonNodeConverter_CanConvertFromArrays()
{
// Arrange and act
- var array = (JsonNode?) new OpenIddictParameter(new[] { "Contoso", "Fabrikam" });
+ var array = (JsonNode?) new OpenIddictParameter(["Contoso", "Fabrikam"]);
// Assert
Assert.Equal("Contoso", array!.AsArray()[0]!.GetValue());
@@ -1878,7 +1878,7 @@ public class OpenIddictParameterTests
public void JsonArrayConverter_CanConvertFromArrays()
{
// Arrange and act
- var array = (JsonArray?) new OpenIddictParameter(new[] { "Contoso", "Fabrikam" });
+ var array = (JsonArray?) new OpenIddictParameter(["Contoso", "Fabrikam"]);
// Assert
Assert.Equal("Contoso", array![0]!.GetValue());
@@ -1932,7 +1932,7 @@ public class OpenIddictParameterTests
{
// Assert, arrange and act
Assert.Null((JsonObject?) new OpenIddictParameter(@"[""Contoso"",""Fabrikam""]"));
- Assert.Null((JsonObject?) new OpenIddictParameter(new[] { "Contoso", "Fabrikam" }));
+ Assert.Null((JsonObject?) new OpenIddictParameter(["Contoso", "Fabrikam"]));
}
[Fact]
@@ -1958,7 +1958,7 @@ public class OpenIddictParameterTests
{
// Assert, arrange and act
Assert.Null((JsonValue?) new OpenIddictParameter(@"[""Contoso"",""Fabrikam""]"));
- Assert.Null((JsonValue?) new OpenIddictParameter(new[] { "Contoso", "Fabrikam" }));
+ Assert.Null((JsonValue?) new OpenIddictParameter(["Contoso", "Fabrikam"]));
Assert.Null((JsonValue?) new OpenIddictParameter(@"{""Property"":""value""}"));
@@ -1997,8 +1997,8 @@ public class OpenIddictParameterTests
public void LongConverter_ReturnsDefaultValueForUnsupportedArrays()
{
// Arrange, act and assert
- Assert.Equal(0, (long) new OpenIddictParameter(new[] { "Contoso", "Fabrikam" }));
- Assert.Null((long?) new OpenIddictParameter(new[] { "Contoso", "Fabrikam" }));
+ Assert.Equal(0, (long) new OpenIddictParameter(["Contoso", "Fabrikam"]));
+ Assert.Null((long?) new OpenIddictParameter(["Contoso", "Fabrikam"]));
}
[Fact]
@@ -2065,7 +2065,7 @@ public class OpenIddictParameterTests
public void StringConverter_ReturnsDefaultValueForArrays()
{
// Arrange, act and assert
- Assert.Null((string?) new OpenIddictParameter(new[] { "Contoso", "Fabrikam" }));
+ Assert.Null((string?) new OpenIddictParameter(["Contoso", "Fabrikam"]));
}
[Fact]
@@ -2138,9 +2138,9 @@ public class OpenIddictParameterTests
public void StringArrayConverter_CanCreateParameterFromPrimitiveValues()
{
// Arrange, act and assert
- Assert.Equal(new[] { "Fabrikam" }, (string?[]?) new OpenIddictParameter("Fabrikam"));
- Assert.Equal(new[] { "False" }, (string?[]?) new OpenIddictParameter(false));
- Assert.Equal(new[] { "42" }, (string?[]?) new OpenIddictParameter(42));
+ Assert.Equal(["Fabrikam"], (string?[]?) new OpenIddictParameter("Fabrikam"));
+ Assert.Equal(["False"], (string?[]?) new OpenIddictParameter(false));
+ Assert.Equal(["42"], (string?[]?) new OpenIddictParameter(42));
}
[Fact]
@@ -2154,7 +2154,7 @@ public class OpenIddictParameterTests
public void StringArrayConverter_ReturnsSingleElementArrayForStringValue()
{
// Arrange, act and assert
- Assert.Equal(new[] { "Fabrikam" }, (string?[]?) new OpenIddictParameter("Fabrikam"));
+ Assert.Equal(["Fabrikam"], (string?[]?) new OpenIddictParameter("Fabrikam"));
}
[Fact]
@@ -2179,27 +2179,27 @@ public class OpenIddictParameterTests
public void StringArrayConverter_CanConvertFromJsonValues()
{
// Arrange, act and assert
- Assert.Equal(new[] { "Fabrikam" }, (string?[]?) new OpenIddictParameter(
+ Assert.Equal(["Fabrikam"], (string?[]?) new OpenIddictParameter(
JsonSerializer.Deserialize(@"{""field"":""Fabrikam""}").GetProperty("field")));
- Assert.Equal(new[] { "False" }, (string?[]?) new OpenIddictParameter(
+ Assert.Equal(["False"], (string?[]?) new OpenIddictParameter(
JsonSerializer.Deserialize(@"{""field"":false}").GetProperty("field")));
- Assert.Equal(new[] { "42" }, (string?[]?) new OpenIddictParameter(
+ Assert.Equal(["42"], (string?[]?) new OpenIddictParameter(
JsonSerializer.Deserialize(@"{""field"":42}").GetProperty("field")));
- Assert.Equal(new[] { "Fabrikam" }, (string?[]?) new OpenIddictParameter(
+ Assert.Equal(["Fabrikam"], (string?[]?) new OpenIddictParameter(
JsonSerializer.Deserialize(@"[""Fabrikam""]")));
- Assert.Equal(new[] { "Contoso", "Fabrikam" }, (string?[]?) new OpenIddictParameter(
+ Assert.Equal(["Contoso", "Fabrikam"], (string?[]?) new OpenIddictParameter(
JsonSerializer.Deserialize(@"[""Contoso"",""Fabrikam""]")));
- Assert.Equal(new[] { "value", "42", bool.TrueString }, (string?[]?) new OpenIddictParameter(
+ Assert.Equal(["value", "42", bool.TrueString], (string?[]?) new OpenIddictParameter(
JsonSerializer.Deserialize(@"[""value"",42,true]")));
#if SUPPORTS_JSON_NODES
- Assert.Equal(new[] { "Fabrikam" }, (string?[]?) new OpenIddictParameter(JsonValue.Create("Fabrikam")));
- Assert.Equal(new[] { bool.FalseString }, (string?[]?) new OpenIddictParameter(JsonValue.Create(false)));
- Assert.Equal(new[] { "42" }, (string?[]?) new OpenIddictParameter(JsonValue.Create(42)));
- Assert.Equal(new[] { "42" }, (string?[]?) new OpenIddictParameter(JsonValue.Create(42L)));
- Assert.Equal(new[] { "Fabrikam" }, (string?[]?) new OpenIddictParameter(new JsonArray("Fabrikam")));
- Assert.Equal(new[] { "Contoso", "Fabrikam" }, (string?[]?) new OpenIddictParameter(new JsonArray("Contoso", "Fabrikam")));
- Assert.Equal(new[] { "value", "42", bool.TrueString }, (string?[]?) new OpenIddictParameter(new JsonArray("value", 42, true)));
+ Assert.Equal(["Fabrikam"], (string?[]?) new OpenIddictParameter(JsonValue.Create("Fabrikam")));
+ Assert.Equal([bool.FalseString], (string?[]?) new OpenIddictParameter(JsonValue.Create(false)));
+ Assert.Equal(["42"], (string?[]?) new OpenIddictParameter(JsonValue.Create(42)));
+ Assert.Equal(["42"], (string?[]?) new OpenIddictParameter(JsonValue.Create(42L)));
+ Assert.Equal(["Fabrikam"], (string?[]?) new OpenIddictParameter(new JsonArray("Fabrikam")));
+ Assert.Equal(["Contoso", "Fabrikam"], (string?[]?) new OpenIddictParameter(new JsonArray("Contoso", "Fabrikam")));
+ Assert.Equal(["value", "42", bool.TrueString], (string?[]?) new OpenIddictParameter(new JsonArray("value", 42, true)));
#endif
}
}
diff --git a/test/OpenIddict.Abstractions.Tests/Primitives/OpenIddictRequestTests.cs b/test/OpenIddict.Abstractions.Tests/Primitives/OpenIddictRequestTests.cs
index 5fa90643..50d40712 100644
--- a/test/OpenIddict.Abstractions.Tests/Primitives/OpenIddictRequestTests.cs
+++ b/test/OpenIddict.Abstractions.Tests/Primitives/OpenIddictRequestTests.cs
@@ -41,7 +41,7 @@ public class OpenIddictRequestTests
{
/* property: */ nameof(OpenIddictRequest.Audiences),
/* name: */ Parameters.Audience,
- /* value: */ new OpenIddictParameter(new[] { "Fabrikam", "Contoso" })
+ /* value: */ new OpenIddictParameter(["Fabrikam", "Contoso"])
};
yield return new object[]
@@ -244,7 +244,7 @@ public class OpenIddictRequestTests
{
/* property: */ nameof(OpenIddictRequest.Resources),
/* name: */ Parameters.Resource,
- /* value: */ new OpenIddictParameter(new[] { "https://fabrikam.com/", "https://contoso.com/" })
+ /* value: */ new OpenIddictParameter(["https://fabrikam.com/", "https://contoso.com/"])
};
yield return new object[]
diff --git a/test/OpenIddict.Server.AspNetCore.IntegrationTests/OpenIddictServerAspNetCoreIntegrationTests.cs b/test/OpenIddict.Server.AspNetCore.IntegrationTests/OpenIddictServerAspNetCoreIntegrationTests.cs
index b8773d56..d89c5b4b 100644
--- a/test/OpenIddict.Server.AspNetCore.IntegrationTests/OpenIddictServerAspNetCoreIntegrationTests.cs
+++ b/test/OpenIddict.Server.AspNetCore.IntegrationTests/OpenIddictServerAspNetCoreIntegrationTests.cs
@@ -55,7 +55,7 @@ public partial class OpenIddictServerAspNetCoreIntegrationTests : OpenIddictServ
builder.UseInlineHandler(context =>
{
Assert.Equal("access_token", context.Token);
- Assert.Equal(new[] { TokenTypeHints.AccessToken }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.AccessToken], context.ValidTokenTypes);
context.Principal = new ClaimsPrincipal(new ClaimsIdentity("Bearer"))
.SetTokenType(TokenTypeHints.AccessToken)
@@ -106,7 +106,7 @@ public partial class OpenIddictServerAspNetCoreIntegrationTests : OpenIddictServ
builder.UseInlineHandler(context =>
{
Assert.Equal("access_token", context.Token);
- Assert.Equal(new[] { TokenTypeHints.AccessToken }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.AccessToken], context.ValidTokenTypes);
context.Principal = new ClaimsPrincipal(new ClaimsIdentity("Bearer"))
.SetTokenType(TokenTypeHints.AccessToken)
@@ -211,13 +211,13 @@ public partial class OpenIddictServerAspNetCoreIntegrationTests : OpenIddictServ
Assert.Equal(JsonValueKind.Number, ((JsonElement) response["integer_parameter"]).ValueKind);
Assert.Equal("Bob l'Eponge", (string?) response["string_parameter"]);
Assert.Equal(JsonValueKind.String, ((JsonElement) response["string_parameter"]).ValueKind);
- Assert.Equal(new[] { "Contoso", "Fabrikam" }, (string[]?) response["array_parameter"]);
+ Assert.Equal(["Contoso", "Fabrikam"], (string[]?) response["array_parameter"]);
Assert.Equal(JsonValueKind.Array, ((JsonElement) response["array_parameter"]).ValueKind);
Assert.Equal("value", (string?) response["object_parameter"]?["parameter"]);
Assert.Equal(JsonValueKind.Object, ((JsonElement) response["object_parameter"]).ValueKind);
#if SUPPORTS_JSON_NODES
- Assert.Equal(new[] { "Contoso", "Fabrikam" }, (string[]?) response["node_array_parameter"]);
+ Assert.Equal(["Contoso", "Fabrikam"], (string[]?) response["node_array_parameter"]);
Assert.IsType((JsonNode?) response["node_array_parameter"]);
Assert.Equal("value", (string?) response["node_object_parameter"]?["parameter"]);
Assert.IsType((JsonNode?) response["node_object_parameter"]);
@@ -445,13 +445,13 @@ public partial class OpenIddictServerAspNetCoreIntegrationTests : OpenIddictServ
Assert.Equal(JsonValueKind.Number, ((JsonElement) response["integer_parameter"]).ValueKind);
Assert.Equal("Bob l'Eponge", (string?) response["string_parameter"]);
Assert.Equal(JsonValueKind.String, ((JsonElement) response["string_parameter"]).ValueKind);
- Assert.Equal(new[] { "Contoso", "Fabrikam" }, (string[]?) response["array_parameter"]);
+ Assert.Equal(["Contoso", "Fabrikam"], (string[]?) response["array_parameter"]);
Assert.Equal(JsonValueKind.Array, ((JsonElement) response["array_parameter"]).ValueKind);
Assert.Equal("value", (string?) response["object_parameter"]?["parameter"]);
Assert.Equal(JsonValueKind.Object, ((JsonElement) response["object_parameter"]).ValueKind);
#if SUPPORTS_JSON_NODES
- Assert.Equal(new[] { "Contoso", "Fabrikam" }, (string[]?) response["node_array_parameter"]);
+ Assert.Equal(["Contoso", "Fabrikam"], (string[]?) response["node_array_parameter"]);
Assert.IsType((JsonNode?) response["node_array_parameter"]);
Assert.Equal("value", (string?) response["node_object_parameter"]?["parameter"]);
Assert.IsType((JsonNode?) response["node_object_parameter"]);
diff --git a/test/OpenIddict.Server.IntegrationTests/OpenIddict.Server.IntegrationTests.csproj b/test/OpenIddict.Server.IntegrationTests/OpenIddict.Server.IntegrationTests.csproj
index 62adfbfc..e2af95ab 100644
--- a/test/OpenIddict.Server.IntegrationTests/OpenIddict.Server.IntegrationTests.csproj
+++ b/test/OpenIddict.Server.IntegrationTests/OpenIddict.Server.IntegrationTests.csproj
@@ -33,10 +33,6 @@
-
-
-
-
diff --git a/test/OpenIddict.Server.IntegrationTests/OpenIddictServerIntegrationTests.Authentication.cs b/test/OpenIddict.Server.IntegrationTests/OpenIddictServerIntegrationTests.Authentication.cs
index b6d87ba6..2a005e51 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(ImmutableArray.Create());
+ .ReturnsAsync([]);
});
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(ImmutableArray.Create());
+ .ReturnsAsync([]);
});
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(ImmutableArray.Create("rst:" + type));
+ .ReturnsAsync(["rst:" + type]);
mock.Setup(manager => manager.ValidateRedirectUriAsync(application, "http://www.fabrikam.com/path", It.IsAny()))
.ReturnsAsync(true);
@@ -1946,7 +1946,7 @@ public abstract partial class OpenIddictServerIntegrationTests
builder.UseInlineHandler(context =>
{
Assert.Equal("id_token", context.Token);
- Assert.Equal(new[] { TokenTypeHints.IdToken }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.IdToken], context.ValidTokenTypes);
context.Principal = new ClaimsPrincipal(new ClaimsIdentity("Bearer"))
.SetTokenType(TokenTypeHints.IdToken)
@@ -2017,7 +2017,7 @@ public abstract partial class OpenIddictServerIntegrationTests
builder.UseInlineHandler(context =>
{
Assert.Equal("id_token", context.Token);
- Assert.Equal(new[] { TokenTypeHints.IdToken }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.IdToken], context.ValidTokenTypes);
context.Principal = new ClaimsPrincipal(new ClaimsIdentity("Bearer"))
.SetTokenType(TokenTypeHints.IdToken)
@@ -2326,7 +2326,7 @@ public abstract partial class OpenIddictServerIntegrationTests
Assert.Null(response.ErrorUri);
Assert.NotNull(response.AccessToken);
Assert.Equal("custom_value", (string?) response["custom_parameter"]);
- Assert.Equal(new[] { "custom_value_1", "custom_value_2" }, (string[]?) response["parameter_with_multiple_values"]);
+ Assert.Equal(["custom_value_1", "custom_value_2"], (string[]?) response["parameter_with_multiple_values"]);
}
[Theory]
@@ -2468,7 +2468,7 @@ public abstract partial class OpenIddictServerIntegrationTests
// Assert
Assert.Equal("custom_value", (string?) response["custom_parameter"]);
- Assert.Equal(new[] { "custom_value_1", "custom_value_2" }, (string[]?) response["parameter_with_multiple_values"]);
+ Assert.Equal(["custom_value_1", "custom_value_2"], (string[]?) response["parameter_with_multiple_values"]);
}
[Fact]
diff --git a/test/OpenIddict.Server.IntegrationTests/OpenIddictServerIntegrationTests.Device.cs b/test/OpenIddict.Server.IntegrationTests/OpenIddictServerIntegrationTests.Device.cs
index 98f63e12..4c5f3b77 100644
--- a/test/OpenIddict.Server.IntegrationTests/OpenIddictServerIntegrationTests.Device.cs
+++ b/test/OpenIddict.Server.IntegrationTests/OpenIddictServerIntegrationTests.Device.cs
@@ -1051,7 +1051,7 @@ public abstract partial class OpenIddictServerIntegrationTests
Assert.Null(response.ErrorUri);
Assert.NotNull(response.DeviceCode);
Assert.Equal("custom_value", (string?) response["custom_parameter"]);
- Assert.Equal(new[] { "custom_value_1", "custom_value_2" }, (string[]?) response["parameter_with_multiple_values"]);
+ Assert.Equal(["custom_value_1", "custom_value_2"], (string[]?) response["parameter_with_multiple_values"]);
}
[Fact]
@@ -1136,7 +1136,7 @@ public abstract partial class OpenIddictServerIntegrationTests
// Assert
Assert.Equal("custom_value", (string?) response["custom_parameter"]);
- Assert.Equal(new[] { "custom_value_1", "custom_value_2" }, (string[]?) response["parameter_with_multiple_values"]);
+ Assert.Equal(["custom_value_1", "custom_value_2"], (string[]?) response["parameter_with_multiple_values"]);
}
[Theory]
@@ -1449,7 +1449,7 @@ public abstract partial class OpenIddictServerIntegrationTests
builder.UseInlineHandler(context =>
{
Assert.Equal("WDJB-MJHT", context.Token);
- Assert.Equal(new[] { TokenTypeHints.UserCode }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.UserCode], context.ValidTokenTypes);
context.Principal = new ClaimsPrincipal(new ClaimsIdentity())
.SetTokenType(TokenTypeHints.UserCode);
@@ -1496,7 +1496,7 @@ public abstract partial class OpenIddictServerIntegrationTests
// Assert
Assert.Equal("custom_value", (string?) response["custom_parameter"]);
- Assert.Equal(new[] { "custom_value_1", "custom_value_2" }, (string[]?) response["parameter_with_multiple_values"]);
+ Assert.Equal(["custom_value_1", "custom_value_2"], (string[]?) response["parameter_with_multiple_values"]);
}
[Fact]
diff --git a/test/OpenIddict.Server.IntegrationTests/OpenIddictServerIntegrationTests.Discovery.cs b/test/OpenIddict.Server.IntegrationTests/OpenIddictServerIntegrationTests.Discovery.cs
index 3b9c2cf5..47e1921a 100644
--- a/test/OpenIddict.Server.IntegrationTests/OpenIddictServerIntegrationTests.Discovery.cs
+++ b/test/OpenIddict.Server.IntegrationTests/OpenIddictServerIntegrationTests.Discovery.cs
@@ -1556,6 +1556,6 @@ public abstract partial class OpenIddictServerIntegrationTests
// Assert
Assert.Equal("custom_value", (string?) response["custom_parameter"]);
- Assert.Equal(new[] { "custom_value_1", "custom_value_2" }, (string[]?) response["parameter_with_multiple_values"]);
+ Assert.Equal(["custom_value_1", "custom_value_2"], (string[]?) response["parameter_with_multiple_values"]);
}
}
diff --git a/test/OpenIddict.Server.IntegrationTests/OpenIddictServerIntegrationTests.Exchange.cs b/test/OpenIddict.Server.IntegrationTests/OpenIddictServerIntegrationTests.Exchange.cs
index 4f7e6db5..3e5ede62 100644
--- a/test/OpenIddict.Server.IntegrationTests/OpenIddictServerIntegrationTests.Exchange.cs
+++ b/test/OpenIddict.Server.IntegrationTests/OpenIddictServerIntegrationTests.Exchange.cs
@@ -299,7 +299,7 @@ public abstract partial class OpenIddictServerIntegrationTests
builder.UseInlineHandler(context =>
{
Assert.Equal("SplxlOBeZQQYbYS6WxSbIA", context.Token);
- Assert.Equal(new[] { TokenTypeHints.AuthorizationCode }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.AuthorizationCode], context.ValidTokenTypes);
context.Principal = new ClaimsPrincipal(new ClaimsIdentity("Bearer"))
.SetTokenType(TokenTypeHints.AuthorizationCode)
@@ -446,7 +446,7 @@ public abstract partial class OpenIddictServerIntegrationTests
builder.UseInlineHandler(context =>
{
Assert.Equal("SplxlOBeZQQYbYS6WxSbIA", context.Token);
- Assert.Equal(new[] { TokenTypeHints.AuthorizationCode }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.AuthorizationCode], context.ValidTokenTypes);
context.Principal = new ClaimsPrincipal(new ClaimsIdentity("Bearer"))
.SetTokenType(TokenTypeHints.AuthorizationCode)
@@ -489,7 +489,7 @@ public abstract partial class OpenIddictServerIntegrationTests
builder.UseInlineHandler(context =>
{
Assert.Equal("8xLOxBtZp8", context.Token);
- Assert.Equal(new[] { TokenTypeHints.RefreshToken }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.RefreshToken], context.ValidTokenTypes);
context.Principal = new ClaimsPrincipal(new ClaimsIdentity("Bearer"))
.SetTokenType(TokenTypeHints.RefreshToken)
@@ -558,7 +558,7 @@ public abstract partial class OpenIddictServerIntegrationTests
builder.UseInlineHandler(context =>
{
Assert.Equal("GmRhmhcxhwAzkoEqiMEg_DnyEysNkuNhszIySk9eS", context.Token);
- Assert.Equal(new[] { TokenTypeHints.DeviceCode }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.DeviceCode], context.ValidTokenTypes);
context.Principal = new ClaimsPrincipal(new ClaimsIdentity("Bearer"))
.SetClaim(Claims.Subject, "Bob le Bricoleur")
@@ -605,7 +605,7 @@ public abstract partial class OpenIddictServerIntegrationTests
builder.UseInlineHandler(context =>
{
Assert.Equal("SplxlOBeZQQYbYS6WxSbIA", context.Token);
- Assert.Equal(new[] { TokenTypeHints.AuthorizationCode }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.AuthorizationCode], context.ValidTokenTypes);
context.Principal = new ClaimsPrincipal(new ClaimsIdentity("Bearer"))
.SetTokenType(TokenTypeHints.AuthorizationCode)
@@ -648,7 +648,7 @@ public abstract partial class OpenIddictServerIntegrationTests
builder.UseInlineHandler(context =>
{
Assert.Equal("SplxlOBeZQQYbYS6WxSbIA", context.Token);
- Assert.Equal(new[] { TokenTypeHints.AuthorizationCode }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.AuthorizationCode], context.ValidTokenTypes);
context.Principal = new ClaimsPrincipal(new ClaimsIdentity("Bearer"))
.SetTokenType(TokenTypeHints.AuthorizationCode)
@@ -691,7 +691,7 @@ public abstract partial class OpenIddictServerIntegrationTests
builder.UseInlineHandler(context =>
{
Assert.Equal("8xLOxBtZp8", context.Token);
- Assert.Equal(new[] { TokenTypeHints.RefreshToken }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.RefreshToken], context.ValidTokenTypes);
context.Principal = new ClaimsPrincipal(new ClaimsIdentity("Bearer"))
.SetTokenType(TokenTypeHints.RefreshToken)
@@ -734,7 +734,7 @@ public abstract partial class OpenIddictServerIntegrationTests
builder.UseInlineHandler(context =>
{
Assert.Equal("SplxlOBeZQQYbYS6WxSbIA", context.Token);
- Assert.Equal(new[] { TokenTypeHints.AuthorizationCode }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.AuthorizationCode], context.ValidTokenTypes);
context.Principal = new ClaimsPrincipal(new ClaimsIdentity("Bearer"))
.SetTokenType(TokenTypeHints.AuthorizationCode)
@@ -779,7 +779,7 @@ public abstract partial class OpenIddictServerIntegrationTests
builder.UseInlineHandler(context =>
{
Assert.Equal("SplxlOBeZQQYbYS6WxSbIA", context.Token);
- Assert.Equal(new[] { TokenTypeHints.AuthorizationCode }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.AuthorizationCode], context.ValidTokenTypes);
context.Principal = new ClaimsPrincipal(new ClaimsIdentity("Bearer"))
.SetTokenType(TokenTypeHints.AuthorizationCode)
@@ -824,7 +824,7 @@ public abstract partial class OpenIddictServerIntegrationTests
builder.UseInlineHandler(context =>
{
Assert.Equal("SplxlOBeZQQYbYS6WxSbIA", context.Token);
- Assert.Equal(new[] { TokenTypeHints.AuthorizationCode }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.AuthorizationCode], context.ValidTokenTypes);
context.Principal = new ClaimsPrincipal(new ClaimsIdentity("Bearer"))
.SetTokenType(TokenTypeHints.AuthorizationCode)
@@ -868,7 +868,7 @@ public abstract partial class OpenIddictServerIntegrationTests
builder.UseInlineHandler(context =>
{
Assert.Equal("SplxlOBeZQQYbYS6WxSbIA", context.Token);
- Assert.Equal(new[] { TokenTypeHints.AuthorizationCode }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.AuthorizationCode], context.ValidTokenTypes);
context.Principal = new ClaimsPrincipal(new ClaimsIdentity("Bearer"))
.SetTokenType(TokenTypeHints.AuthorizationCode)
@@ -914,7 +914,7 @@ public abstract partial class OpenIddictServerIntegrationTests
builder.UseInlineHandler(context =>
{
Assert.Equal("SplxlOBeZQQYbYS6WxSbIA", context.Token);
- Assert.Equal(new[] { TokenTypeHints.AuthorizationCode }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.AuthorizationCode], context.ValidTokenTypes);
context.Principal = new ClaimsPrincipal(new ClaimsIdentity("Bearer"))
.SetTokenType(TokenTypeHints.AuthorizationCode)
@@ -959,7 +959,7 @@ public abstract partial class OpenIddictServerIntegrationTests
builder.UseInlineHandler(context =>
{
Assert.Equal("SplxlOBeZQQYbYS6WxSbIA", context.Token);
- Assert.Equal(new[] { TokenTypeHints.AuthorizationCode }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.AuthorizationCode], context.ValidTokenTypes);
context.Principal = new ClaimsPrincipal(new ClaimsIdentity("Bearer"))
.SetTokenType(TokenTypeHints.AuthorizationCode)
@@ -1007,7 +1007,7 @@ public abstract partial class OpenIddictServerIntegrationTests
builder.UseInlineHandler(context =>
{
Assert.Equal("SplxlOBeZQQYbYS6WxSbIA", context.Token);
- Assert.Equal(new[] { TokenTypeHints.AuthorizationCode }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.AuthorizationCode], context.ValidTokenTypes);
context.Principal = new ClaimsPrincipal(new ClaimsIdentity("Bearer"))
.SetTokenType(TokenTypeHints.AuthorizationCode)
@@ -1055,7 +1055,7 @@ public abstract partial class OpenIddictServerIntegrationTests
builder.UseInlineHandler(context =>
{
Assert.Equal("SplxlOBeZQQYbYS6WxSbIA", context.Token);
- Assert.Equal(new[] { TokenTypeHints.AuthorizationCode }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.AuthorizationCode], context.ValidTokenTypes);
context.Principal = new ClaimsPrincipal(new ClaimsIdentity("Bearer"))
.SetTokenType(TokenTypeHints.AuthorizationCode)
@@ -1109,7 +1109,7 @@ public abstract partial class OpenIddictServerIntegrationTests
builder.UseInlineHandler(context =>
{
Assert.Equal("8xLOxBtZp8", context.Token);
- Assert.Equal(new[] { TokenTypeHints.RefreshToken }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.RefreshToken], context.ValidTokenTypes);
context.Principal = new ClaimsPrincipal(new ClaimsIdentity("Bearer"))
.SetTokenType(TokenTypeHints.RefreshToken)
@@ -1153,7 +1153,7 @@ public abstract partial class OpenIddictServerIntegrationTests
builder.UseInlineHandler(context =>
{
Assert.Equal("8xLOxBtZp8", context.Token);
- Assert.Equal(new[] { TokenTypeHints.RefreshToken }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.RefreshToken], context.ValidTokenTypes);
context.Principal = new ClaimsPrincipal(new ClaimsIdentity("Bearer"))
.SetTokenType(TokenTypeHints.RefreshToken)
@@ -1945,7 +1945,7 @@ public abstract partial class OpenIddictServerIntegrationTests
builder.UseInlineHandler(context =>
{
Assert.Equal("SplxlOBeZQQYbYS6WxSbIA", context.Token);
- Assert.Equal(new[] { TokenTypeHints.AuthorizationCode }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.AuthorizationCode], context.ValidTokenTypes);
context.Principal = new ClaimsPrincipal(new ClaimsIdentity("Bearer"))
.SetTokenType(TokenTypeHints.AuthorizationCode)
@@ -2017,7 +2017,7 @@ public abstract partial class OpenIddictServerIntegrationTests
builder.UseInlineHandler(context =>
{
Assert.Equal("SplxlOBeZQQYbYS6WxSbIA", context.Token);
- Assert.Equal(new[] { TokenTypeHints.AuthorizationCode }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.AuthorizationCode], context.ValidTokenTypes);
context.Principal = new ClaimsPrincipal(new ClaimsIdentity("Bearer"))
.SetTokenType(TokenTypeHints.AuthorizationCode)
@@ -2088,7 +2088,7 @@ public abstract partial class OpenIddictServerIntegrationTests
builder.UseInlineHandler(context =>
{
Assert.Equal("SplxlOBeZQQYbYS6WxSbIA", context.Token);
- Assert.Equal(new[] { TokenTypeHints.AuthorizationCode }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.AuthorizationCode], context.ValidTokenTypes);
context.Principal = new ClaimsPrincipal(new ClaimsIdentity("Bearer"))
.SetTokenType(TokenTypeHints.AuthorizationCode)
@@ -2250,7 +2250,7 @@ public abstract partial class OpenIddictServerIntegrationTests
builder.UseInlineHandler(context =>
{
Assert.Equal("SplxlOBeZQQYbYS6WxSbIA", context.Token);
- Assert.Equal(new[] { TokenTypeHints.AuthorizationCode }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.AuthorizationCode], context.ValidTokenTypes);
context.Principal = new ClaimsPrincipal(new ClaimsIdentity("Bearer"))
.SetTokenType(TokenTypeHints.AuthorizationCode)
@@ -2320,7 +2320,7 @@ public abstract partial class OpenIddictServerIntegrationTests
builder.UseInlineHandler(context =>
{
Assert.Equal("8xLOxBtZp8", context.Token);
- Assert.Equal(new[] { TokenTypeHints.RefreshToken }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.RefreshToken], context.ValidTokenTypes);
context.Principal = new ClaimsPrincipal(new ClaimsIdentity("Bearer"))
.SetTokenType(TokenTypeHints.RefreshToken)
@@ -2379,7 +2379,7 @@ public abstract partial class OpenIddictServerIntegrationTests
builder.UseInlineHandler(context =>
{
Assert.Equal("SplxlOBeZQQYbYS6WxSbIA", context.Token);
- Assert.Equal(new[] { TokenTypeHints.AuthorizationCode }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.AuthorizationCode], context.ValidTokenTypes);
context.Principal = new ClaimsPrincipal(new ClaimsIdentity("Bearer"))
.SetTokenType(TokenTypeHints.AuthorizationCode)
@@ -2451,7 +2451,7 @@ public abstract partial class OpenIddictServerIntegrationTests
builder.UseInlineHandler(context =>
{
Assert.Equal("8xLOxBtZp8", context.Token);
- Assert.Equal(new[] { TokenTypeHints.RefreshToken }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.RefreshToken], context.ValidTokenTypes);
context.Principal = new ClaimsPrincipal(new ClaimsIdentity("Bearer"))
.SetTokenType(TokenTypeHints.RefreshToken)
@@ -2522,7 +2522,7 @@ public abstract partial class OpenIddictServerIntegrationTests
builder.UseInlineHandler(context =>
{
Assert.Equal("SplxlOBeZQQYbYS6WxSbIA", context.Token);
- Assert.Equal(new[] { TokenTypeHints.AuthorizationCode }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.AuthorizationCode], context.ValidTokenTypes);
context.Principal = new ClaimsPrincipal(new ClaimsIdentity("Bearer"))
.SetTokenType(TokenTypeHints.AuthorizationCode)
@@ -2613,7 +2613,7 @@ public abstract partial class OpenIddictServerIntegrationTests
builder.UseInlineHandler(context =>
{
Assert.Equal("8xLOxBtZp8", context.Token);
- Assert.Equal(new[] { TokenTypeHints.RefreshToken }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.RefreshToken], context.ValidTokenTypes);
context.Principal = new ClaimsPrincipal(new ClaimsIdentity("Bearer"))
.SetTokenType(TokenTypeHints.RefreshToken)
@@ -2690,7 +2690,7 @@ public abstract partial class OpenIddictServerIntegrationTests
builder.UseInlineHandler(context =>
{
Assert.Equal("8xLOxBtZp8", context.Token);
- Assert.Equal(new[] { TokenTypeHints.RefreshToken }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.RefreshToken], context.ValidTokenTypes);
context.Principal = new ClaimsPrincipal(new ClaimsIdentity("Bearer"))
.SetTokenType(TokenTypeHints.RefreshToken)
@@ -2770,7 +2770,7 @@ public abstract partial class OpenIddictServerIntegrationTests
builder.UseInlineHandler(context =>
{
Assert.Equal("8xLOxBtZp8", context.Token);
- Assert.Equal(new[] { TokenTypeHints.RefreshToken }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.RefreshToken], context.ValidTokenTypes);
context.Principal = new ClaimsPrincipal(new ClaimsIdentity("Bearer"))
.SetTokenType(TokenTypeHints.RefreshToken)
@@ -2816,10 +2816,7 @@ public abstract partial class OpenIddictServerIntegrationTests
public async Task HandleTokenRequest_RevokesTokensWhenAuthorizationCodeIsAlreadyRedeemed()
{
// Arrange
- var tokens = ImmutableArray.Create(
- new OpenIddictToken(),
- new OpenIddictToken(),
- new OpenIddictToken());
+ ImmutableArray tokens = [new(), new(), new()];
var manager = CreateTokenManager(mock =>
{
@@ -2855,7 +2852,7 @@ public abstract partial class OpenIddictServerIntegrationTests
builder.UseInlineHandler(context =>
{
Assert.Equal("SplxlOBeZQQYbYS6WxSbIA", context.Token);
- Assert.Equal(new[] { TokenTypeHints.AuthorizationCode }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.AuthorizationCode], context.ValidTokenTypes);
context.Principal = new ClaimsPrincipal(new ClaimsIdentity("Bearer"))
.SetTokenType(TokenTypeHints.AuthorizationCode)
@@ -2920,10 +2917,7 @@ public abstract partial class OpenIddictServerIntegrationTests
public async Task HandleTokenRequest_RevokesTokensWhenRefreshTokenIsAlreadyRedeemedAndLeewayIsNull()
{
// Arrange
- var tokens = ImmutableArray.Create(
- new OpenIddictToken(),
- new OpenIddictToken(),
- new OpenIddictToken());
+ ImmutableArray tokens = [new(), new(), new()];
var manager = CreateTokenManager(mock =>
{
@@ -2964,7 +2958,7 @@ public abstract partial class OpenIddictServerIntegrationTests
builder.UseInlineHandler(context =>
{
Assert.Equal("8xLOxBtZp8", context.Token);
- Assert.Equal(new[] { TokenTypeHints.RefreshToken }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.RefreshToken], context.ValidTokenTypes);
context.Principal = new ClaimsPrincipal(new ClaimsIdentity("Bearer"))
.SetTokenType(TokenTypeHints.RefreshToken)
@@ -3016,10 +3010,7 @@ public abstract partial class OpenIddictServerIntegrationTests
public async Task HandleTokenRequest_RevokesTokensWhenRefreshTokenIsAlreadyRedeemedAndCannotBeReused()
{
// Arrange
- var tokens = ImmutableArray.Create(
- new OpenIddictToken(),
- new OpenIddictToken(),
- new OpenIddictToken());
+ ImmutableArray tokens = [new(), new(), new()];
var manager = CreateTokenManager(mock =>
{
@@ -3060,7 +3051,7 @@ public abstract partial class OpenIddictServerIntegrationTests
builder.UseInlineHandler(context =>
{
Assert.Equal("8xLOxBtZp8", context.Token);
- Assert.Equal(new[] { TokenTypeHints.RefreshToken }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.RefreshToken], context.ValidTokenTypes);
context.Principal = new ClaimsPrincipal(new ClaimsIdentity("Bearer"))
.SetTokenType(TokenTypeHints.RefreshToken)
@@ -3112,10 +3103,7 @@ public abstract partial class OpenIddictServerIntegrationTests
public async Task HandleTokenRequest_DoesNotRevokeTokensWhenRefreshTokenIsAlreadyRedeemedAndCanBeReused()
{
// Arrange
- var tokens = ImmutableArray.Create(
- new OpenIddictToken(),
- new OpenIddictToken(),
- new OpenIddictToken());
+ ImmutableArray tokens = [new(), new(), new()];
var manager = CreateTokenManager(mock =>
{
@@ -3159,7 +3147,7 @@ public abstract partial class OpenIddictServerIntegrationTests
builder.UseInlineHandler(context =>
{
Assert.Equal("8xLOxBtZp8", context.Token);
- Assert.Equal(new[] { TokenTypeHints.RefreshToken }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.RefreshToken], context.ValidTokenTypes);
context.Principal = new ClaimsPrincipal(new ClaimsIdentity("Bearer"))
.SetTokenType(TokenTypeHints.RefreshToken)
@@ -3246,7 +3234,7 @@ public abstract partial class OpenIddictServerIntegrationTests
builder.UseInlineHandler(context =>
{
Assert.Equal("SplxlOBeZQQYbYS6WxSbIA", context.Token);
- Assert.Equal(new[] { TokenTypeHints.AuthorizationCode }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.AuthorizationCode], context.ValidTokenTypes);
context.Principal = new ClaimsPrincipal(new ClaimsIdentity("Bearer"))
.SetTokenType(TokenTypeHints.AuthorizationCode)
@@ -3336,7 +3324,7 @@ public abstract partial class OpenIddictServerIntegrationTests
builder.UseInlineHandler(context =>
{
Assert.Equal("8xLOxBtZp8", context.Token);
- Assert.Equal(new[] { TokenTypeHints.RefreshToken }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.RefreshToken], context.ValidTokenTypes);
context.Principal = new ClaimsPrincipal(new ClaimsIdentity("Bearer"))
.SetTokenType(TokenTypeHints.RefreshToken)
@@ -3398,7 +3386,7 @@ public abstract partial class OpenIddictServerIntegrationTests
builder.UseInlineHandler(context =>
{
Assert.Equal("SplxlOBeZQQYbYS6WxSbIA", context.Token);
- Assert.Equal(new[] { TokenTypeHints.AuthorizationCode }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.AuthorizationCode], context.ValidTokenTypes);
context.Principal = new ClaimsPrincipal(new ClaimsIdentity("Bearer"))
.SetTokenType(TokenTypeHints.AuthorizationCode)
@@ -3508,7 +3496,7 @@ public abstract partial class OpenIddictServerIntegrationTests
builder.UseInlineHandler(context =>
{
Assert.Equal("8xLOxBtZp8", context.Token);
- Assert.Equal(new[] { TokenTypeHints.RefreshToken }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.RefreshToken], context.ValidTokenTypes);
context.Principal = new ClaimsPrincipal(new ClaimsIdentity("Bearer"))
.SetTokenType(TokenTypeHints.RefreshToken)
@@ -3594,7 +3582,7 @@ public abstract partial class OpenIddictServerIntegrationTests
builder.UseInlineHandler(context =>
{
Assert.Equal("SplxlOBeZQQYbYS6WxSbIA", context.Token);
- Assert.Equal(new[] { TokenTypeHints.AuthorizationCode }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.AuthorizationCode], context.ValidTokenTypes);
context.Principal = new ClaimsPrincipal(new ClaimsIdentity("Bearer"))
.SetTokenType(TokenTypeHints.AuthorizationCode)
@@ -3696,7 +3684,7 @@ public abstract partial class OpenIddictServerIntegrationTests
builder.UseInlineHandler(context =>
{
Assert.Equal("SplxlOBeZQQYbYS6WxSbIA", context.Token);
- Assert.Equal(new[] { TokenTypeHints.AuthorizationCode }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.AuthorizationCode], context.ValidTokenTypes);
context.Principal = new ClaimsPrincipal(new ClaimsIdentity("Bearer"))
.SetTokenType(TokenTypeHints.AuthorizationCode)
@@ -3794,7 +3782,7 @@ public abstract partial class OpenIddictServerIntegrationTests
builder.UseInlineHandler(context =>
{
Assert.Equal("8xLOxBtZp8", context.Token);
- Assert.Equal(new[] { TokenTypeHints.RefreshToken }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.RefreshToken], context.ValidTokenTypes);
context.Principal = new ClaimsPrincipal(new ClaimsIdentity("Bearer"))
.SetTokenType(TokenTypeHints.RefreshToken)
@@ -3882,7 +3870,7 @@ public abstract partial class OpenIddictServerIntegrationTests
builder.UseInlineHandler(context =>
{
Assert.Equal("8xLOxBtZp8", context.Token);
- Assert.Equal(new[] { TokenTypeHints.RefreshToken }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.RefreshToken], context.ValidTokenTypes);
context.Principal = new ClaimsPrincipal(new ClaimsIdentity("Bearer"))
.SetTokenType(TokenTypeHints.RefreshToken)
@@ -3986,7 +3974,7 @@ public abstract partial class OpenIddictServerIntegrationTests
builder.UseInlineHandler(context =>
{
Assert.Equal("SplxlOBeZQQYbYS6WxSbIA", context.Token);
- Assert.Equal(new[] { TokenTypeHints.AuthorizationCode }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.AuthorizationCode], context.ValidTokenTypes);
context.Principal = new ClaimsPrincipal(new ClaimsIdentity("Bearer"))
.SetTokenType(TokenTypeHints.AuthorizationCode)
@@ -4302,7 +4290,7 @@ public abstract partial class OpenIddictServerIntegrationTests
Assert.Null(response.ErrorUri);
Assert.NotNull(response.AccessToken);
Assert.Equal("custom_value", (string?) response["custom_parameter"]);
- Assert.Equal(new[] { "custom_value_1", "custom_value_2" }, (string[]?) response["parameter_with_multiple_values"]);
+ Assert.Equal(["custom_value_1", "custom_value_2"], (string[]?) response["parameter_with_multiple_values"]);
}
[Fact]
@@ -4393,6 +4381,6 @@ public abstract partial class OpenIddictServerIntegrationTests
// Assert
Assert.Equal("custom_value", (string?) response["custom_parameter"]);
- Assert.Equal(new[] { "custom_value_1", "custom_value_2" }, (string[]?) response["parameter_with_multiple_values"]);
+ Assert.Equal(["custom_value_1", "custom_value_2"], (string[]?) response["parameter_with_multiple_values"]);
}
}
diff --git a/test/OpenIddict.Server.IntegrationTests/OpenIddictServerIntegrationTests.Introspection.cs b/test/OpenIddict.Server.IntegrationTests/OpenIddictServerIntegrationTests.Introspection.cs
index 6875934b..490e84f5 100644
--- a/test/OpenIddict.Server.IntegrationTests/OpenIddictServerIntegrationTests.Introspection.cs
+++ b/test/OpenIddict.Server.IntegrationTests/OpenIddictServerIntegrationTests.Introspection.cs
@@ -1048,7 +1048,7 @@ public abstract partial class OpenIddictServerIntegrationTests
Assert.Equal(JsonValueKind.True, ((JsonElement) response["boolean_claim"]).ValueKind);
Assert.Equal(42, (long) response["integer_claim"]);
Assert.Equal(JsonValueKind.Number, ((JsonElement) response["integer_claim"]).ValueKind);
- Assert.Equal(new[] { "Contoso", "Fabrikam" }, (string[]?) response["array_claim"]);
+ Assert.Equal(["Contoso", "Fabrikam"], (string[]?) response["array_claim"]);
Assert.Equal(JsonValueKind.Array, ((JsonElement) response["array_claim"]).ValueKind);
Assert.Equal("value", (string?) response["object_claim"]?["parameter"]);
Assert.Equal(JsonValueKind.Object, ((JsonElement) response["object_claim"]).ValueKind);
@@ -1827,6 +1827,6 @@ public abstract partial class OpenIddictServerIntegrationTests
// Assert
Assert.Equal("custom_value", (string?) response["custom_parameter"]);
- Assert.Equal(new[] { "custom_value_1", "custom_value_2" }, (string[]?) response["parameter_with_multiple_values"]);
+ Assert.Equal(["custom_value_1", "custom_value_2"], (string[]?) response["parameter_with_multiple_values"]);
}
}
diff --git a/test/OpenIddict.Server.IntegrationTests/OpenIddictServerIntegrationTests.Protection.cs b/test/OpenIddict.Server.IntegrationTests/OpenIddictServerIntegrationTests.Protection.cs
index 353cd972..d4b19a1d 100644
--- a/test/OpenIddict.Server.IntegrationTests/OpenIddictServerIntegrationTests.Protection.cs
+++ b/test/OpenIddict.Server.IntegrationTests/OpenIddictServerIntegrationTests.Protection.cs
@@ -38,7 +38,7 @@ public abstract partial class OpenIddictServerIntegrationTests
builder.UseInlineHandler(context =>
{
Assert.Equal("access_token", context.Token);
- Assert.Equal(new[] { TokenTypeHints.AccessToken }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.AccessToken], context.ValidTokenTypes);
var identity = new ClaimsIdentity("Bearer");
identity.AddClaim(new Claim(Claims.IssuedAt, "1577836800", ClaimValueTypes.Integer64));
@@ -90,7 +90,7 @@ public abstract partial class OpenIddictServerIntegrationTests
builder.UseInlineHandler(context =>
{
Assert.Equal("access_token", context.Token);
- Assert.Equal(new[] { TokenTypeHints.AccessToken }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.AccessToken], context.ValidTokenTypes);
var identity = new ClaimsIdentity("Bearer");
identity.AddClaim(new Claim(Claims.ExpiresAt, "2524608000", ClaimValueTypes.Integer64));
@@ -142,7 +142,7 @@ public abstract partial class OpenIddictServerIntegrationTests
builder.UseInlineHandler(context =>
{
Assert.Equal("access_token", context.Token);
- Assert.Equal(new[] { TokenTypeHints.AccessToken }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.AccessToken], context.ValidTokenTypes);
context.Principal = new ClaimsPrincipal(new ClaimsIdentity("Bearer"))
.SetTokenType(TokenTypeHints.AccessToken)
@@ -192,7 +192,7 @@ public abstract partial class OpenIddictServerIntegrationTests
builder.UseInlineHandler(context =>
{
Assert.Equal("access_token", context.Token);
- Assert.Equal(new[] { TokenTypeHints.AccessToken }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.AccessToken], context.ValidTokenTypes);
context.Principal = new ClaimsPrincipal(new ClaimsIdentity("Bearer"))
.SetTokenType(TokenTypeHints.AccessToken)
@@ -242,7 +242,7 @@ public abstract partial class OpenIddictServerIntegrationTests
builder.UseInlineHandler(context =>
{
Assert.Equal("access_token", context.Token);
- Assert.Equal(new[] { TokenTypeHints.AccessToken }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.AccessToken], context.ValidTokenTypes);
context.Principal = new ClaimsPrincipal(new ClaimsIdentity("Bearer"))
.SetTokenType(TokenTypeHints.AccessToken)
@@ -292,12 +292,12 @@ public abstract partial class OpenIddictServerIntegrationTests
builder.UseInlineHandler(context =>
{
Assert.Equal("access_token", context.Token);
- Assert.Equal(new[] { TokenTypeHints.AccessToken }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.AccessToken], context.ValidTokenTypes);
context.Principal = new ClaimsPrincipal(new ClaimsIdentity("Bearer"))
.SetTokenType(TokenTypeHints.AccessToken)
.SetClaim(Claims.Subject, "Bob le Magnifique")
- .SetClaims(Claims.Audience, ImmutableArray.Create("Fabrikam", "Contoso"));
+ .SetClaims(Claims.Audience, ["Fabrikam", "Contoso"]);
return default;
});
@@ -316,8 +316,8 @@ public abstract partial class OpenIddictServerIntegrationTests
// Assert
Assert.Equal("Bob le Magnifique", (string?) response[Claims.Subject]);
- Assert.Equal(new[] { "Fabrikam", "Contoso" }, (string[]?) response[Claims.Audience]);
- Assert.Equal(new[] { "Fabrikam", "Contoso" }, (string[]?) response[Claims.Private.Audience]);
+ Assert.Equal(["Fabrikam", "Contoso"], (string[]?) response[Claims.Audience]);
+ Assert.Equal(["Fabrikam", "Contoso"], (string[]?) response[Claims.Private.Audience]);
}
[Fact]
@@ -342,12 +342,12 @@ public abstract partial class OpenIddictServerIntegrationTests
builder.UseInlineHandler(context =>
{
Assert.Equal("access_token", context.Token);
- Assert.Equal(new[] { TokenTypeHints.AccessToken }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.AccessToken], context.ValidTokenTypes);
context.Principal = new ClaimsPrincipal(new ClaimsIdentity("Bearer"))
.SetTokenType(TokenTypeHints.AccessToken)
.SetClaim(Claims.Subject, "Bob le Magnifique")
- .SetClaims(Claims.Scope, ImmutableArray.Create(Scopes.OpenId, Scopes.Profile));
+ .SetClaims(Claims.Scope, [Scopes.OpenId, Scopes.Profile]);
return default;
});
@@ -391,7 +391,7 @@ public abstract partial class OpenIddictServerIntegrationTests
builder.UseInlineHandler(context =>
{
Assert.Equal("access_token", context.Token);
- Assert.Equal(new[] { TokenTypeHints.AccessToken }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.AccessToken], context.ValidTokenTypes);
context.Principal = new ClaimsPrincipal(new ClaimsIdentity("Bearer"))
.SetTokenType(TokenTypeHints.AccessToken)
@@ -415,7 +415,7 @@ public abstract partial class OpenIddictServerIntegrationTests
// Assert
Assert.Equal("Bob le Magnifique", (string?) response[Claims.Subject]);
- Assert.Equal(new[] { Scopes.OpenId, Scopes.Profile }, (string[]?) response[Claims.Private.Scope]);
+ Assert.Equal([Scopes.OpenId, Scopes.Profile], (string[]?) response[Claims.Private.Scope]);
}
[Fact]
@@ -440,12 +440,12 @@ public abstract partial class OpenIddictServerIntegrationTests
builder.UseInlineHandler(context =>
{
Assert.Equal("access_token", context.Token);
- Assert.Equal(new[] { TokenTypeHints.AccessToken }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.AccessToken], context.ValidTokenTypes);
context.Principal = new ClaimsPrincipal(new ClaimsIdentity("Bearer"))
.SetTokenType(TokenTypeHints.AccessToken)
.SetClaim(Claims.Subject, "Bob le Magnifique")
- .SetClaims(Claims.Scope, ImmutableArray.Create(Scopes.OpenId, Scopes.Profile));
+ .SetClaims(Claims.Scope, [Scopes.OpenId, Scopes.Profile]);
return default;
});
@@ -464,7 +464,7 @@ public abstract partial class OpenIddictServerIntegrationTests
// Assert
Assert.Equal("Bob le Magnifique", (string?) response[Claims.Subject]);
- Assert.Equal(new[] { Scopes.OpenId, Scopes.Profile }, (string[]?) response[Claims.Private.Scope]);
+ Assert.Equal([Scopes.OpenId, Scopes.Profile], (string[]?) response[Claims.Private.Scope]);
}
[Fact]
@@ -529,7 +529,7 @@ public abstract partial class OpenIddictServerIntegrationTests
builder.UseInlineHandler(context =>
{
Assert.Equal("access_token", context.Token);
- Assert.Equal(new[] { TokenTypeHints.AccessToken }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.AccessToken], context.ValidTokenTypes);
context.Principal = new ClaimsPrincipal(new ClaimsIdentity("Bearer"))
.SetTokenType(TokenTypeHints.AuthorizationCode)
diff --git a/test/OpenIddict.Server.IntegrationTests/OpenIddictServerIntegrationTests.Revocation.cs b/test/OpenIddict.Server.IntegrationTests/OpenIddictServerIntegrationTests.Revocation.cs
index b87e32db..bf2314e8 100644
--- a/test/OpenIddict.Server.IntegrationTests/OpenIddictServerIntegrationTests.Revocation.cs
+++ b/test/OpenIddict.Server.IntegrationTests/OpenIddictServerIntegrationTests.Revocation.cs
@@ -1167,6 +1167,6 @@ public abstract partial class OpenIddictServerIntegrationTests
// Assert
Assert.Equal("custom_value", (string?) response["custom_parameter"]);
- Assert.Equal(new[] { "custom_value_1", "custom_value_2" }, (string[]?) response["parameter_with_multiple_values"]);
+ Assert.Equal(["custom_value_1", "custom_value_2"], (string[]?) response["parameter_with_multiple_values"]);
}
}
diff --git a/test/OpenIddict.Server.IntegrationTests/OpenIddictServerIntegrationTests.Session.cs b/test/OpenIddict.Server.IntegrationTests/OpenIddictServerIntegrationTests.Session.cs
index 232f4363..dd8d3992 100644
--- a/test/OpenIddict.Server.IntegrationTests/OpenIddictServerIntegrationTests.Session.cs
+++ b/test/OpenIddict.Server.IntegrationTests/OpenIddictServerIntegrationTests.Session.cs
@@ -415,7 +415,7 @@ public abstract partial class OpenIddictServerIntegrationTests
.ReturnsAsync(application);
mock.Setup(manager => manager.GetPostLogoutRedirectUrisAsync(application, It.IsAny()))
- .ReturnsAsync(ImmutableArray.Create("http://www.fabrikam.com/path"));
+ .ReturnsAsync(["http://www.fabrikam.com/path"]);
mock.Setup(manager => manager.HasPermissionAsync(application,
Permissions.Endpoints.Logout, It.IsAny()))
@@ -531,7 +531,7 @@ public abstract partial class OpenIddictServerIntegrationTests
builder.UseInlineHandler(context =>
{
Assert.Equal("id_token", context.Token);
- Assert.Equal(new[] { TokenTypeHints.IdToken }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.IdToken], context.ValidTokenTypes);
context.Principal = new ClaimsPrincipal(new ClaimsIdentity("Bearer"))
.SetTokenType(TokenTypeHints.IdToken)
@@ -605,7 +605,7 @@ public abstract partial class OpenIddictServerIntegrationTests
builder.UseInlineHandler(context =>
{
Assert.Equal("id_token", context.Token);
- Assert.Equal(new[] { TokenTypeHints.IdToken }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.IdToken], context.ValidTokenTypes);
context.Principal = new ClaimsPrincipal(new ClaimsIdentity("Bearer"))
.SetTokenType(TokenTypeHints.IdToken)
@@ -670,7 +670,7 @@ public abstract partial class OpenIddictServerIntegrationTests
builder.UseInlineHandler(context =>
{
Assert.Equal("id_token", context.Token);
- Assert.Equal(new[] { TokenTypeHints.IdToken }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.IdToken], context.ValidTokenTypes);
context.Principal = new ClaimsPrincipal(new ClaimsIdentity("Bearer"))
.SetTokenType(TokenTypeHints.IdToken)
@@ -933,7 +933,7 @@ public abstract partial class OpenIddictServerIntegrationTests
// Assert
Assert.Equal("custom_value", (string?) response["custom_parameter"]);
- Assert.Equal(new[] { "custom_value_1", "custom_value_2" }, (string[]?) response["parameter_with_multiple_values"]);
+ Assert.Equal(["custom_value_1", "custom_value_2"], (string[]?) response["parameter_with_multiple_values"]);
}
[Fact]
@@ -1015,7 +1015,7 @@ public abstract partial class OpenIddictServerIntegrationTests
// Assert
Assert.Equal("custom_value", (string?) response["custom_parameter"]);
- Assert.Equal(new[] { "custom_value_1", "custom_value_2" }, (string[]?) response["parameter_with_multiple_values"]);
+ Assert.Equal(["custom_value_1", "custom_value_2"], (string[]?) response["parameter_with_multiple_values"]);
}
[Fact]
diff --git a/test/OpenIddict.Server.IntegrationTests/OpenIddictServerIntegrationTests.Userinfo.cs b/test/OpenIddict.Server.IntegrationTests/OpenIddictServerIntegrationTests.Userinfo.cs
index 52791143..117b1fd3 100644
--- a/test/OpenIddict.Server.IntegrationTests/OpenIddictServerIntegrationTests.Userinfo.cs
+++ b/test/OpenIddict.Server.IntegrationTests/OpenIddictServerIntegrationTests.Userinfo.cs
@@ -387,7 +387,7 @@ public abstract partial class OpenIddictServerIntegrationTests
Assert.Equal(3, response.Count);
Assert.Equal("http://localhost/", (string?) response[Claims.Issuer]);
Assert.Equal("Bob le Magnifique", (string?) response[Claims.Subject]);
- Assert.Equal(new[] { "Fabrikam", "Contoso" }, (string[]?) response[Claims.Audience]);
+ Assert.Equal(["Fabrikam", "Contoso"], (string[]?) response[Claims.Audience]);
}
[Fact]
@@ -808,6 +808,6 @@ public abstract partial class OpenIddictServerIntegrationTests
// Assert
Assert.Equal("custom_value", (string?) response["custom_parameter"]);
- Assert.Equal(new[] { "custom_value_1", "custom_value_2" }, (string[]?) response["parameter_with_multiple_values"]);
+ Assert.Equal(["custom_value_1", "custom_value_2"], (string[]?) response["parameter_with_multiple_values"]);
}
}
diff --git a/test/OpenIddict.Server.IntegrationTests/OpenIddictServerIntegrationTests.cs b/test/OpenIddict.Server.IntegrationTests/OpenIddictServerIntegrationTests.cs
index 65f61403..83869a0b 100644
--- a/test/OpenIddict.Server.IntegrationTests/OpenIddictServerIntegrationTests.cs
+++ b/test/OpenIddict.Server.IntegrationTests/OpenIddictServerIntegrationTests.cs
@@ -566,7 +566,7 @@ public abstract partial class OpenIddictServerIntegrationTests
builder.UseInlineHandler(context =>
{
Assert.Equal("access_token", context.Token);
- Assert.Equal(new[] { TokenTypeHints.AccessToken }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.AccessToken], context.ValidTokenTypes);
context.Principal = new ClaimsPrincipal(new ClaimsIdentity("Bearer"))
.SetTokenType(TokenTypeHints.AccessToken)
@@ -673,7 +673,7 @@ public abstract partial class OpenIddictServerIntegrationTests
builder.UseInlineHandler(context =>
{
Assert.Equal("id_token", context.Token);
- Assert.Equal(new[] { TokenTypeHints.IdToken }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.IdToken], context.ValidTokenTypes);
context.Principal = new ClaimsPrincipal(new ClaimsIdentity("Bearer"))
.SetTokenType(TokenTypeHints.IdToken)
@@ -784,7 +784,7 @@ public abstract partial class OpenIddictServerIntegrationTests
builder.UseInlineHandler(context =>
{
Assert.Equal("authorization_code", context.Token);
- Assert.Equal(new[] { TokenTypeHints.AuthorizationCode }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.AuthorizationCode], context.ValidTokenTypes);
context.Principal = new ClaimsPrincipal(new ClaimsIdentity("Bearer"))
.SetTokenType(TokenTypeHints.AuthorizationCode)
@@ -896,7 +896,7 @@ public abstract partial class OpenIddictServerIntegrationTests
builder.UseInlineHandler(context =>
{
Assert.Equal("refresh_token", context.Token);
- Assert.Equal(new[] { TokenTypeHints.RefreshToken }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.RefreshToken], context.ValidTokenTypes);
context.Principal = new ClaimsPrincipal(new ClaimsIdentity("Bearer"))
.SetTokenType(TokenTypeHints.RefreshToken)
@@ -1229,13 +1229,13 @@ public abstract partial class OpenIddictServerIntegrationTests
Assert.Equal(JsonValueKind.Number, ((JsonElement) response["integer_parameter"]).ValueKind);
Assert.Equal("Bob l'Eponge", (string?) response["string_parameter"]);
Assert.Equal(JsonValueKind.String, ((JsonElement) response["string_parameter"]).ValueKind);
- Assert.Equal(new[] { "Contoso", "Fabrikam" }, (string[]?) response["array_parameter"]);
+ Assert.Equal(["Contoso", "Fabrikam"], (string[]?) response["array_parameter"]);
Assert.Equal(JsonValueKind.Array, ((JsonElement) response["array_parameter"]).ValueKind);
Assert.Equal("value", (string?) response["object_parameter"]?["parameter"]);
Assert.Equal(JsonValueKind.Object, ((JsonElement) response["object_parameter"]).ValueKind);
#if SUPPORTS_JSON_NODES
- Assert.Equal(new[] { "Contoso", "Fabrikam" }, (string[]?) response["node_array_parameter"]);
+ Assert.Equal(["Contoso", "Fabrikam"], (string[]?) response["node_array_parameter"]);
Assert.IsType((JsonNode?) response["node_array_parameter"]);
Assert.Equal("value", (string?) response["node_object_parameter"]?["parameter"]);
Assert.IsType((JsonNode?) response["node_object_parameter"]);
@@ -1469,7 +1469,7 @@ public abstract partial class OpenIddictServerIntegrationTests
options.AddEventHandler(builder =>
builder.UseInlineHandler(context =>
{
- Assert.Equal(new[] { Scopes.OpenId }, context.Principal!.GetScopes());
+ Assert.Equal([Scopes.OpenId], context.Principal!.GetScopes(), StringComparer.Ordinal);
return default;
}));
@@ -1512,7 +1512,7 @@ public abstract partial class OpenIddictServerIntegrationTests
options.AddEventHandler(builder =>
builder.UseInlineHandler(context =>
{
- Assert.Equal(new[] { "http://www.fabrikam.com/" }, context.Principal!.GetResources());
+ Assert.Equal(["http://www.fabrikam.com/"], context.Principal!.GetResources(), StringComparer.Ordinal);
return default;
}));
@@ -1713,7 +1713,7 @@ public abstract partial class OpenIddictServerIntegrationTests
builder.UseInlineHandler(context =>
{
Assert.Equal("SplxlOBeZQQYbYS6WxSbIA", context.Token);
- Assert.Equal(new[] { TokenTypeHints.AuthorizationCode }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.AuthorizationCode], context.ValidTokenTypes);
context.Principal = new ClaimsPrincipal(new ClaimsIdentity("Bearer"))
.SetTokenType(TokenTypeHints.AuthorizationCode)
@@ -1767,7 +1767,7 @@ public abstract partial class OpenIddictServerIntegrationTests
builder.UseInlineHandler(context =>
{
Assert.Equal("GmRhmhcxhwAzkoEqiMEg_DnyEysNkuNhszIySk9eS", context.Token);
- Assert.Equal(new[] { TokenTypeHints.DeviceCode }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.DeviceCode], context.ValidTokenTypes);
context.Principal = new ClaimsPrincipal(new ClaimsIdentity())
.SetTokenType(TokenTypeHints.DeviceCode)
@@ -1833,7 +1833,7 @@ public abstract partial class OpenIddictServerIntegrationTests
builder.UseInlineHandler(context =>
{
Assert.Equal("8xLOxBtZp8", context.Token);
- Assert.Equal(new[] { TokenTypeHints.RefreshToken }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.RefreshToken], context.ValidTokenTypes);
context.Principal = new ClaimsPrincipal(new ClaimsIdentity("Bearer"))
.SetTokenType(TokenTypeHints.RefreshToken)
@@ -2113,7 +2113,7 @@ public abstract partial class OpenIddictServerIntegrationTests
builder.UseInlineHandler(context =>
{
Assert.Equal("8xLOxBtZp8", context.Token);
- Assert.Equal(new[] { TokenTypeHints.RefreshToken }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.RefreshToken], context.ValidTokenTypes);
context.Principal = new ClaimsPrincipal(new ClaimsIdentity("Bearer"))
.SetTokenType(TokenTypeHints.RefreshToken)
@@ -2130,7 +2130,7 @@ public abstract partial class OpenIddictServerIntegrationTests
{
builder.UseInlineHandler(context =>
{
- Assert.Equal(new[] { Scopes.Profile }, context.AccessTokenPrincipal!.GetScopes());
+ Assert.Equal([Scopes.Profile], context.AccessTokenPrincipal!.GetScopes(), StringComparer.Ordinal);
return default;
});
@@ -2211,7 +2211,7 @@ public abstract partial class OpenIddictServerIntegrationTests
builder.UseInlineHandler(context =>
{
Assert.Equal("SplxlOBeZQQYbYS6WxSbIA", context.Token);
- Assert.Equal(new[] { TokenTypeHints.AuthorizationCode }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.AuthorizationCode], context.ValidTokenTypes);
context.Principal = new ClaimsPrincipal(new ClaimsIdentity("Bearer"))
.SetTokenType(TokenTypeHints.AuthorizationCode)
@@ -2266,7 +2266,7 @@ public abstract partial class OpenIddictServerIntegrationTests
builder.UseInlineHandler(context =>
{
Assert.Equal("GmRhmhcxhwAzkoEqiMEg_DnyEysNkuNhszIySk9eS", context.Token);
- Assert.Equal(new[] { TokenTypeHints.DeviceCode }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.DeviceCode], context.ValidTokenTypes);
context.Principal = new ClaimsPrincipal(new ClaimsIdentity())
.SetTokenType(TokenTypeHints.DeviceCode)
@@ -2333,7 +2333,7 @@ public abstract partial class OpenIddictServerIntegrationTests
builder.UseInlineHandler(context =>
{
Assert.Equal("8xLOxBtZp8", context.Token);
- Assert.Equal(new[] { TokenTypeHints.RefreshToken }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.RefreshToken], context.ValidTokenTypes);
context.Principal = new ClaimsPrincipal(new ClaimsIdentity("Bearer"))
.SetTokenType(TokenTypeHints.RefreshToken)
@@ -2619,7 +2619,7 @@ public abstract partial class OpenIddictServerIntegrationTests
builder.UseInlineHandler(context =>
{
Assert.Equal("SplxlOBeZQQYbYS6WxSbIA", context.Token);
- Assert.Equal(new[] { TokenTypeHints.AuthorizationCode }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.AuthorizationCode], context.ValidTokenTypes);
context.Principal = new ClaimsPrincipal(new ClaimsIdentity("Bearer"))
.SetTokenType(TokenTypeHints.AuthorizationCode)
@@ -2674,7 +2674,7 @@ public abstract partial class OpenIddictServerIntegrationTests
builder.UseInlineHandler(context =>
{
Assert.Equal("GmRhmhcxhwAzkoEqiMEg_DnyEysNkuNhszIySk9eS", context.Token);
- Assert.Equal(new[] { TokenTypeHints.DeviceCode }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.DeviceCode], context.ValidTokenTypes);
context.Principal = new ClaimsPrincipal(new ClaimsIdentity())
.SetTokenType(TokenTypeHints.DeviceCode)
@@ -2741,7 +2741,7 @@ public abstract partial class OpenIddictServerIntegrationTests
builder.UseInlineHandler(context =>
{
Assert.Equal("8xLOxBtZp8", context.Token);
- Assert.Equal(new[] { TokenTypeHints.RefreshToken }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.RefreshToken], context.ValidTokenTypes);
context.Principal = new ClaimsPrincipal(new ClaimsIdentity("Bearer"))
.SetTokenType(TokenTypeHints.RefreshToken)
@@ -2973,7 +2973,7 @@ public abstract partial class OpenIddictServerIntegrationTests
builder.UseInlineHandler(context =>
{
Assert.Equal("8xLOxBtZp8", context.Token);
- Assert.Equal(new[] { TokenTypeHints.RefreshToken }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.RefreshToken], context.ValidTokenTypes);
context.Principal = new ClaimsPrincipal(new ClaimsIdentity("Bearer"))
.SetTokenType(TokenTypeHints.RefreshToken)
@@ -2990,7 +2990,7 @@ public abstract partial class OpenIddictServerIntegrationTests
options.AddEventHandler(builder =>
builder.UseInlineHandler(context =>
{
- Assert.Equal(new[] { Scopes.OpenId, Scopes.OfflineAccess }, context.Principal!.GetScopes());
+ Assert.Equal([Scopes.OpenId, Scopes.OfflineAccess], context.Principal!.GetScopes(), StringComparer.Ordinal);
Assert.Equal("value", context.Principal!.GetClaim(Claims.Prefixes.Private + "_private_claim"));
return default;
@@ -3045,7 +3045,7 @@ public abstract partial class OpenIddictServerIntegrationTests
builder.UseInlineHandler(context =>
{
Assert.Equal("SplxlOBeZQQYbYS6WxSbIA", context.Token);
- Assert.Equal(new[] { TokenTypeHints.AuthorizationCode }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.AuthorizationCode], context.ValidTokenTypes);
context.Principal = new ClaimsPrincipal(new ClaimsIdentity("Bearer"))
.SetTokenType(TokenTypeHints.AuthorizationCode)
@@ -3132,7 +3132,7 @@ public abstract partial class OpenIddictServerIntegrationTests
builder.UseInlineHandler(context =>
{
Assert.Equal("8xLOxBtZp8", context.Token);
- Assert.Equal(new[] { TokenTypeHints.RefreshToken }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.RefreshToken], context.ValidTokenTypes);
context.Principal = new ClaimsPrincipal(new ClaimsIdentity("Bearer"))
.SetTokenType(TokenTypeHints.RefreshToken)
@@ -3199,7 +3199,7 @@ public abstract partial class OpenIddictServerIntegrationTests
builder.UseInlineHandler(context =>
{
Assert.Equal("8xLOxBtZp8", context.Token);
- Assert.Equal(new[] { TokenTypeHints.RefreshToken }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.RefreshToken], context.ValidTokenTypes);
context.Principal = new ClaimsPrincipal(new ClaimsIdentity("Bearer"))
.SetTokenType(TokenTypeHints.RefreshToken)
@@ -3603,13 +3603,13 @@ public abstract partial class OpenIddictServerIntegrationTests
Assert.Equal(JsonValueKind.Number, ((JsonElement) response["integer_parameter"]).ValueKind);
Assert.Equal("Bob l'Eponge", (string?) response["string_parameter"]);
Assert.Equal(JsonValueKind.String, ((JsonElement) response["string_parameter"]).ValueKind);
- Assert.Equal(new[] { "Contoso", "Fabrikam" }, (string[]?) response["array_parameter"]);
+ Assert.Equal(["Contoso", "Fabrikam"], (string[]?) response["array_parameter"]);
Assert.Equal(JsonValueKind.Array, ((JsonElement) response["array_parameter"]).ValueKind);
Assert.Equal("value", (string?) response["object_parameter"]?["parameter"]);
Assert.Equal(JsonValueKind.Object, ((JsonElement) response["object_parameter"]).ValueKind);
#if SUPPORTS_JSON_NODES
- Assert.Equal(new[] { "Contoso", "Fabrikam" }, (string[]?) response["node_array_parameter"]);
+ Assert.Equal(["Contoso", "Fabrikam"], (string[]?) response["node_array_parameter"]);
Assert.IsType((JsonNode?) response["node_array_parameter"]);
Assert.Equal("value", (string?) response["node_object_parameter"]?["parameter"]);
Assert.IsType((JsonNode?) response["node_object_parameter"]);
diff --git a/test/OpenIddict.Server.Owin.IntegrationTests/OpenIddictServerOwinIntegrationTests.cs b/test/OpenIddict.Server.Owin.IntegrationTests/OpenIddictServerOwinIntegrationTests.cs
index 880b92c2..075edf63 100644
--- a/test/OpenIddict.Server.Owin.IntegrationTests/OpenIddictServerOwinIntegrationTests.cs
+++ b/test/OpenIddict.Server.Owin.IntegrationTests/OpenIddictServerOwinIntegrationTests.cs
@@ -49,7 +49,7 @@ public partial class OpenIddictServerOwinIntegrationTests : OpenIddictServerInte
builder.UseInlineHandler(context =>
{
Assert.Equal("access_token", context.Token);
- Assert.Equal(new[] { TokenTypeHints.AccessToken }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.AccessToken], context.ValidTokenTypes);
context.Principal = new ClaimsPrincipal(new ClaimsIdentity("Bearer"))
.SetTokenType(TokenTypeHints.AccessToken)
@@ -100,7 +100,7 @@ public partial class OpenIddictServerOwinIntegrationTests : OpenIddictServerInte
builder.UseInlineHandler(context =>
{
Assert.Equal("access_token", context.Token);
- Assert.Equal(new[] { TokenTypeHints.AccessToken }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.AccessToken], context.ValidTokenTypes);
context.Principal = new ClaimsPrincipal(new ClaimsIdentity("Bearer"))
.SetTokenType(TokenTypeHints.AccessToken)
@@ -205,7 +205,7 @@ public partial class OpenIddictServerOwinIntegrationTests : OpenIddictServerInte
Assert.Equal(JsonValueKind.Number, ((JsonElement) response["integer_parameter"]).ValueKind);
Assert.Equal("Bob l'Eponge", (string?) response["string_parameter"]);
Assert.Equal(JsonValueKind.String, ((JsonElement) response["string_parameter"]).ValueKind);
- Assert.Equal(new[] { "Contoso", "Fabrikam" }, (string[]?) response["json_parameter"]);
+ Assert.Equal(["Contoso", "Fabrikam"], (string[]?) response["json_parameter"]);
Assert.Equal(JsonValueKind.Array, ((JsonElement) response["json_parameter"]).ValueKind);
}
@@ -430,7 +430,7 @@ public partial class OpenIddictServerOwinIntegrationTests : OpenIddictServerInte
Assert.Equal(JsonValueKind.Number, ((JsonElement) response["integer_parameter"]).ValueKind);
Assert.Equal("Bob l'Eponge", (string?) response["string_parameter"]);
Assert.Equal(JsonValueKind.String, ((JsonElement) response["string_parameter"]).ValueKind);
- Assert.Equal(new[] { "Contoso", "Fabrikam" }, (string[]?) response["json_parameter"]);
+ Assert.Equal(["Contoso", "Fabrikam"], (string[]?) response["json_parameter"]);
Assert.Equal(JsonValueKind.Array, ((JsonElement) response["json_parameter"]).ValueKind);
}
diff --git a/test/OpenIddict.Server.Tests/OpenIddictServerBuilderTests.cs b/test/OpenIddict.Server.Tests/OpenIddictServerBuilderTests.cs
index 35ebd601..41c86a73 100644
--- a/test/OpenIddict.Server.Tests/OpenIddictServerBuilderTests.cs
+++ b/test/OpenIddict.Server.Tests/OpenIddictServerBuilderTests.cs
@@ -1882,7 +1882,7 @@ public class OpenIddictServerBuilderTests
// Arrange
var services = CreateServices();
var builder = CreateBuilder(services);
- string[] claims = { claim };
+ string[] claims = [claim];
// Act and assert
var exception = Assert.Throws(() => builder.RegisterClaims(claims));
@@ -1928,7 +1928,7 @@ public class OpenIddictServerBuilderTests
// Arrange
var services = CreateServices();
var builder = CreateBuilder(services);
- string[] scopes = { scope };
+ string[] scopes = [scope];
// Act and assert
var exception = Assert.Throws(() => builder.RegisterScopes(scopes));
diff --git a/test/OpenIddict.Validation.AspNetCore.IntegrationTests/OpenIddictValidationAspNetCoreIntegrationTests.cs b/test/OpenIddict.Validation.AspNetCore.IntegrationTests/OpenIddictValidationAspNetCoreIntegrationTests.cs
index 7d0b59c6..77f00c63 100644
--- a/test/OpenIddict.Validation.AspNetCore.IntegrationTests/OpenIddictValidationAspNetCoreIntegrationTests.cs
+++ b/test/OpenIddict.Validation.AspNetCore.IntegrationTests/OpenIddictValidationAspNetCoreIntegrationTests.cs
@@ -45,7 +45,7 @@ public partial class OpenIddictValidationAspNetCoreIntegrationTests : OpenIddict
builder.UseInlineHandler(context =>
{
Assert.Equal("access_token", context.Token);
- Assert.Equal(new[] { TokenTypeHints.AccessToken }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.AccessToken], context.ValidTokenTypes);
context.Principal = new ClaimsPrincipal(new ClaimsIdentity("Bearer"))
.SetTokenType(TokenTypeHints.AccessToken)
@@ -85,7 +85,7 @@ public partial class OpenIddictValidationAspNetCoreIntegrationTests : OpenIddict
builder.UseInlineHandler(context =>
{
Assert.Equal("access_token", context.Token);
- Assert.Equal(new[] { TokenTypeHints.AccessToken }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.AccessToken], context.ValidTokenTypes);
context.Principal = new ClaimsPrincipal(new ClaimsIdentity("Bearer"))
.SetTokenType(TokenTypeHints.AccessToken)
diff --git a/test/OpenIddict.Validation.IntegrationTests/OpenIddict.Validation.IntegrationTests.csproj b/test/OpenIddict.Validation.IntegrationTests/OpenIddict.Validation.IntegrationTests.csproj
index a639b92c..745f0a00 100644
--- a/test/OpenIddict.Validation.IntegrationTests/OpenIddict.Validation.IntegrationTests.csproj
+++ b/test/OpenIddict.Validation.IntegrationTests/OpenIddict.Validation.IntegrationTests.csproj
@@ -32,10 +32,6 @@
-
-
-
-
diff --git a/test/OpenIddict.Validation.IntegrationTests/OpenIddictValidationIntegrationTests.cs b/test/OpenIddict.Validation.IntegrationTests/OpenIddictValidationIntegrationTests.cs
index b3783983..cf23191c 100644
--- a/test/OpenIddict.Validation.IntegrationTests/OpenIddictValidationIntegrationTests.cs
+++ b/test/OpenIddict.Validation.IntegrationTests/OpenIddictValidationIntegrationTests.cs
@@ -152,7 +152,7 @@ public abstract partial class OpenIddictValidationIntegrationTests
builder.UseInlineHandler(context =>
{
Assert.Equal("access_token", context.Token);
- Assert.Equal(new[] { TokenTypeHints.AccessToken }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.AccessToken], context.ValidTokenTypes);
context.Principal = new ClaimsPrincipal(new ClaimsIdentity("Bearer"))
.SetTokenType(TokenTypeHints.AccessToken)
diff --git a/test/OpenIddict.Validation.Owin.IntegrationTests/OpenIddictValidationOwinIntegrationTests.cs b/test/OpenIddict.Validation.Owin.IntegrationTests/OpenIddictValidationOwinIntegrationTests.cs
index 63067ebb..d44af856 100644
--- a/test/OpenIddict.Validation.Owin.IntegrationTests/OpenIddictValidationOwinIntegrationTests.cs
+++ b/test/OpenIddict.Validation.Owin.IntegrationTests/OpenIddictValidationOwinIntegrationTests.cs
@@ -39,7 +39,7 @@ public partial class OpenIddictValidationOwinIntegrationTests : OpenIddictValida
builder.UseInlineHandler(context =>
{
Assert.Equal("access_token", context.Token);
- Assert.Equal(new[] { TokenTypeHints.AccessToken }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.AccessToken], context.ValidTokenTypes);
context.Principal = new ClaimsPrincipal(new ClaimsIdentity("Bearer"))
.SetTokenType(TokenTypeHints.AccessToken)
@@ -79,7 +79,7 @@ public partial class OpenIddictValidationOwinIntegrationTests : OpenIddictValida
builder.UseInlineHandler(context =>
{
Assert.Equal("access_token", context.Token);
- Assert.Equal(new[] { TokenTypeHints.AccessToken }, context.ValidTokenTypes);
+ Assert.Equal([TokenTypeHints.AccessToken], context.ValidTokenTypes);
context.Principal = new ClaimsPrincipal(new ClaimsIdentity("Bearer"))
.SetTokenType(TokenTypeHints.AccessToken)