Browse Source

Rename Enable*EndpointCaching to Enable*RequestCaching

pull/1112/head 3.0.0-beta4
Kévin Chalet 5 years ago
parent
commit
921ad7f779
  1. 20
      src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreBuilder.cs
  2. 4
      src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreExtensions.cs
  3. 16
      src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlerFilters.cs
  4. 8
      src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.Authentication.cs
  5. 8
      src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.Session.cs
  6. 8
      src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreOptions.cs
  7. 20
      src/OpenIddict.Server.Owin/OpenIddictServerOwinBuilder.cs
  8. 4
      src/OpenIddict.Server.Owin/OpenIddictServerOwinExtensions.cs
  9. 16
      src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlerFilters.cs
  10. 8
      src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.Authentication.cs
  11. 8
      src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.Session.cs
  12. 8
      src/OpenIddict.Server.Owin/OpenIddictServerOwinOptions.cs
  13. 2
      test/OpenIddict.Server.AspNetCore.IntegrationTests/OpenIddictServerAspNetCoreIntegrationTests.Authentication.cs
  14. 2
      test/OpenIddict.Server.AspNetCore.IntegrationTests/OpenIddictServerAspNetCoreIntegrationTests.Session.cs
  15. 2
      test/OpenIddict.Server.Owin.IntegrationTests/OpenIddictServerOwinIntegrationTests.Authentication.cs
  16. 2
      test/OpenIddict.Server.Owin.IntegrationTests/OpenIddictServerOwinIntegrationTests.Session.cs

20
src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreBuilder.cs

@ -123,23 +123,23 @@ namespace Microsoft.Extensions.DependencyInjection
=> Configure(options => options.EnableVerificationEndpointPassthrough = true);
/// <summary>
/// Enables authorization endpoint caching, so that authorization requests
/// Enables authorization request caching, so that authorization requests
/// are automatically stored in the distributed cache, which allows flowing
/// large payloads across requests. Enabling this option is recommended
/// when using external authentication providers or when large GET or POST
/// OpenID Connect authorization requests support is required.
/// </summary>
/// <returns>The <see cref="OpenIddictServerAspNetCoreBuilder"/>.</returns>
public OpenIddictServerAspNetCoreBuilder EnableAuthorizationEndpointCaching()
=> Configure(options => options.EnableAuthorizationEndpointCaching = true);
public OpenIddictServerAspNetCoreBuilder EnableAuthorizationRequestCaching()
=> Configure(options => options.EnableAuthorizationRequestCaching = true);
/// <summary>
/// Enables logout endpoint caching, so that logout requests
/// Enables logout request caching, so that logout requests
/// are automatically stored in the distributed cache.
/// </summary>
/// <returns>The <see cref="OpenIddictServerAspNetCoreBuilder"/>.</returns>
public OpenIddictServerAspNetCoreBuilder EnableLogoutEndpointCaching()
=> Configure(options => options.EnableLogoutEndpointCaching = true);
public OpenIddictServerAspNetCoreBuilder EnableLogoutRequestCaching()
=> Configure(options => options.EnableLogoutRequestCaching = true);
/// <summary>
/// Enables status code pages integration support. Once enabled, errors
@ -170,14 +170,14 @@ namespace Microsoft.Extensions.DependencyInjection
/// </summary>
/// <param name="policy">The caching policy.</param>
/// <returns>The <see cref="OpenIddictServerAspNetCoreBuilder"/>.</returns>
public OpenIddictServerAspNetCoreBuilder SetAuthorizationEndpointCachingPolicy(DistributedCacheEntryOptions policy)
public OpenIddictServerAspNetCoreBuilder SetAuthorizationRequestCachingPolicy(DistributedCacheEntryOptions policy)
{
if (policy is null)
{
throw new ArgumentNullException(nameof(policy));
}
return Configure(options => options.AuthorizationEndpointCachingPolicy = policy);
return Configure(options => options.AuthorizationRequestCachingPolicy = policy);
}
/// <summary>
@ -186,14 +186,14 @@ namespace Microsoft.Extensions.DependencyInjection
/// </summary>
/// <param name="policy">The caching policy.</param>
/// <returns>The <see cref="OpenIddictServerAspNetCoreBuilder"/>.</returns>
public OpenIddictServerAspNetCoreBuilder SetLogoutEndpointCachingPolicy(DistributedCacheEntryOptions policy)
public OpenIddictServerAspNetCoreBuilder SetLogoutRequestCachingPolicy(DistributedCacheEntryOptions policy)
{
if (policy is null)
{
throw new ArgumentNullException(nameof(policy));
}
return Configure(options => options.LogoutEndpointCachingPolicy = policy);
return Configure(options => options.LogoutRequestCachingPolicy = policy);
}
/// <inheritdoc/>

4
src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreExtensions.cs

@ -43,11 +43,11 @@ namespace Microsoft.Extensions.DependencyInjection
builder.Services.TryAdd(DefaultHandlers.Select(descriptor => descriptor.ServiceDescriptor));
// Register the built-in filters used by the default OpenIddict ASP.NET Core server event handlers.
builder.Services.TryAddSingleton<RequireAuthorizationEndpointCachingEnabled>();
builder.Services.TryAddSingleton<RequireAuthorizationRequestCachingEnabled>();
builder.Services.TryAddSingleton<RequireAuthorizationEndpointPassthroughEnabled>();
builder.Services.TryAddSingleton<RequireErrorPassthroughEnabled>();
builder.Services.TryAddSingleton<RequireHttpRequest>();
builder.Services.TryAddSingleton<RequireLogoutEndpointCachingEnabled>();
builder.Services.TryAddSingleton<RequireLogoutRequestCachingEnabled>();
builder.Services.TryAddSingleton<RequireLogoutEndpointPassthroughEnabled>();
builder.Services.TryAddSingleton<RequireTransportSecurityRequirementEnabled>();
builder.Services.TryAddSingleton<RequireStatusCodePagesIntegrationEnabled>();

16
src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlerFilters.cs

@ -20,13 +20,13 @@ namespace OpenIddict.Server.AspNetCore
public static class OpenIddictServerAspNetCoreHandlerFilters
{
/// <summary>
/// Represents a filter that excludes the associated handlers if authorization endpoint caching was not enabled.
/// Represents a filter that excludes the associated handlers if authorization request caching was not enabled.
/// </summary>
public class RequireAuthorizationEndpointCachingEnabled : IOpenIddictServerHandlerFilter<BaseContext>
public class RequireAuthorizationRequestCachingEnabled : IOpenIddictServerHandlerFilter<BaseContext>
{
private readonly IOptionsMonitor<OpenIddictServerAspNetCoreOptions> _options;
public RequireAuthorizationEndpointCachingEnabled(IOptionsMonitor<OpenIddictServerAspNetCoreOptions> options)
public RequireAuthorizationRequestCachingEnabled(IOptionsMonitor<OpenIddictServerAspNetCoreOptions> options)
=> _options = options;
public ValueTask<bool> IsActiveAsync(BaseContext context)
@ -36,7 +36,7 @@ namespace OpenIddict.Server.AspNetCore
throw new ArgumentNullException(nameof(context));
}
return new ValueTask<bool>(_options.CurrentValue.EnableAuthorizationEndpointCaching);
return new ValueTask<bool>(_options.CurrentValue.EnableAuthorizationRequestCaching);
}
}
@ -100,13 +100,13 @@ namespace OpenIddict.Server.AspNetCore
}
/// <summary>
/// Represents a filter that excludes the associated handlers if logout endpoint caching was not enabled.
/// Represents a filter that excludes the associated handlers if logout request caching was not enabled.
/// </summary>
public class RequireLogoutEndpointCachingEnabled : IOpenIddictServerHandlerFilter<BaseContext>
public class RequireLogoutRequestCachingEnabled : IOpenIddictServerHandlerFilter<BaseContext>
{
private readonly IOptionsMonitor<OpenIddictServerAspNetCoreOptions> _options;
public RequireLogoutEndpointCachingEnabled(IOptionsMonitor<OpenIddictServerAspNetCoreOptions> options)
public RequireLogoutRequestCachingEnabled(IOptionsMonitor<OpenIddictServerAspNetCoreOptions> options)
=> _options = options;
public ValueTask<bool> IsActiveAsync(BaseContext context)
@ -116,7 +116,7 @@ namespace OpenIddict.Server.AspNetCore
throw new ArgumentNullException(nameof(context));
}
return new ValueTask<bool>(_options.CurrentValue.EnableLogoutEndpointCaching);
return new ValueTask<bool>(_options.CurrentValue.EnableLogoutRequestCaching);
}
}

8
src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.Authentication.cs

@ -81,7 +81,7 @@ namespace OpenIddict.Server.AspNetCore
public static OpenIddictServerHandlerDescriptor Descriptor { get; }
= OpenIddictServerHandlerDescriptor.CreateBuilder<ExtractAuthorizationRequestContext>()
.AddFilter<RequireHttpRequest>()
.AddFilter<RequireAuthorizationEndpointCachingEnabled>()
.AddFilter<RequireAuthorizationRequestCachingEnabled>()
.UseSingletonHandler<RestoreCachedRequestParameters>()
.SetOrder(ExtractGetOrPostRequest<ExtractAuthorizationRequestContext>.Descriptor.Order + 1_000)
.SetType(OpenIddictServerHandlerType.BuiltIn)
@ -182,7 +182,7 @@ namespace OpenIddict.Server.AspNetCore
public static OpenIddictServerHandlerDescriptor Descriptor { get; }
= OpenIddictServerHandlerDescriptor.CreateBuilder<ExtractAuthorizationRequestContext>()
.AddFilter<RequireHttpRequest>()
.AddFilter<RequireAuthorizationEndpointCachingEnabled>()
.AddFilter<RequireAuthorizationRequestCachingEnabled>()
.UseSingletonHandler<CacheRequestParameters>()
.SetOrder(RestoreCachedRequestParameters.Descriptor.Order + 1_000)
.SetType(OpenIddictServerHandlerType.BuiltIn)
@ -252,7 +252,7 @@ namespace OpenIddict.Server.AspNetCore
// Note: the cache key is always prefixed with a specific marker
// to avoid collisions with the other types of cached payloads.
await _cache.SetStringAsync(Cache.AuthorizationRequest + context.Request.RequestId,
token, _options.CurrentValue.AuthorizationEndpointCachingPolicy);
token, _options.CurrentValue.AuthorizationRequestCachingPolicy);
// Create a new GET authorization request containing only the request_id parameter.
var address = QueryHelpers.AddQueryString(
@ -286,7 +286,7 @@ namespace OpenIddict.Server.AspNetCore
public static OpenIddictServerHandlerDescriptor Descriptor { get; }
= OpenIddictServerHandlerDescriptor.CreateBuilder<ApplyAuthorizationResponseContext>()
.AddFilter<RequireHttpRequest>()
.AddFilter<RequireAuthorizationEndpointCachingEnabled>()
.AddFilter<RequireAuthorizationRequestCachingEnabled>()
.UseSingletonHandler<RemoveCachedRequest>()
.SetOrder(int.MinValue + 100_000)
.SetType(OpenIddictServerHandlerType.BuiltIn)

8
src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.Session.cs

@ -79,7 +79,7 @@ namespace OpenIddict.Server.AspNetCore
public static OpenIddictServerHandlerDescriptor Descriptor { get; }
= OpenIddictServerHandlerDescriptor.CreateBuilder<ExtractLogoutRequestContext>()
.AddFilter<RequireHttpRequest>()
.AddFilter<RequireLogoutEndpointCachingEnabled>()
.AddFilter<RequireLogoutRequestCachingEnabled>()
.UseSingletonHandler<RestoreCachedRequestParameters>()
.SetOrder(ExtractGetOrPostRequest<ExtractLogoutRequestContext>.Descriptor.Order + 1_000)
.SetType(OpenIddictServerHandlerType.BuiltIn)
@ -180,7 +180,7 @@ namespace OpenIddict.Server.AspNetCore
public static OpenIddictServerHandlerDescriptor Descriptor { get; }
= OpenIddictServerHandlerDescriptor.CreateBuilder<ExtractLogoutRequestContext>()
.AddFilter<RequireHttpRequest>()
.AddFilter<RequireLogoutEndpointCachingEnabled>()
.AddFilter<RequireLogoutRequestCachingEnabled>()
.UseSingletonHandler<CacheRequestParameters>()
.SetOrder(RestoreCachedRequestParameters.Descriptor.Order + 1_000)
.SetType(OpenIddictServerHandlerType.BuiltIn)
@ -250,7 +250,7 @@ namespace OpenIddict.Server.AspNetCore
// Note: the cache key is always prefixed with a specific marker
// to avoid collisions with the other types of cached payloads.
await _cache.SetStringAsync(Cache.LogoutRequest + context.Request.RequestId,
token, _options.CurrentValue.LogoutEndpointCachingPolicy);
token, _options.CurrentValue.LogoutRequestCachingPolicy);
// Create a new GET logout request containing only the request_id parameter.
var address = QueryHelpers.AddQueryString(
@ -284,7 +284,7 @@ namespace OpenIddict.Server.AspNetCore
public static OpenIddictServerHandlerDescriptor Descriptor { get; }
= OpenIddictServerHandlerDescriptor.CreateBuilder<ApplyLogoutResponseContext>()
.AddFilter<RequireHttpRequest>()
.AddFilter<RequireLogoutEndpointCachingEnabled>()
.AddFilter<RequireLogoutRequestCachingEnabled>()
.UseSingletonHandler<RemoveCachedRequest>()
.SetOrder(int.MinValue + 100_000)
.SetType(OpenIddictServerHandlerType.BuiltIn)

8
src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreOptions.cs

@ -81,13 +81,13 @@ namespace OpenIddict.Server.AspNetCore
/// Enabling this option is recommended when using external authentication providers
/// or when large GET or POST OpenID Connect authorization requests support is required.
/// </summary>
public bool EnableAuthorizationEndpointCaching { get; set; }
public bool EnableAuthorizationRequestCaching { get; set; }
/// <summary>
/// Gets or sets a boolean indicating whether requests received by the logout endpoint should be cached.
/// When enabled, authorization requests are automatically stored in the distributed cache.
/// </summary>
public bool EnableLogoutEndpointCaching { get; set; }
public bool EnableLogoutRequestCaching { get; set; }
/// <summary>
/// Gets or sets a boolean indicating whether integration with the status code pages
@ -104,7 +104,7 @@ namespace OpenIddict.Server.AspNetCore
/// <summary>
/// Gets or sets the caching policy used by the authorization endpoint.
/// </summary>
public DistributedCacheEntryOptions AuthorizationEndpointCachingPolicy { get; set; } = new DistributedCacheEntryOptions
public DistributedCacheEntryOptions AuthorizationRequestCachingPolicy { get; set; } = new DistributedCacheEntryOptions
{
AbsoluteExpirationRelativeToNow = TimeSpan.FromHours(1),
SlidingExpiration = TimeSpan.FromMinutes(30)
@ -113,7 +113,7 @@ namespace OpenIddict.Server.AspNetCore
/// <summary>
/// Gets or sets the caching policy used by the logout endpoint.
/// </summary>
public DistributedCacheEntryOptions LogoutEndpointCachingPolicy { get; set; } = new DistributedCacheEntryOptions
public DistributedCacheEntryOptions LogoutRequestCachingPolicy { get; set; } = new DistributedCacheEntryOptions
{
AbsoluteExpirationRelativeToNow = TimeSpan.FromHours(1),
SlidingExpiration = TimeSpan.FromMinutes(30)

20
src/OpenIddict.Server.Owin/OpenIddictServerOwinBuilder.cs

@ -120,23 +120,23 @@ namespace Microsoft.Extensions.DependencyInjection
=> Configure(options => options.EnableVerificationEndpointPassthrough = true);
/// <summary>
/// Enables authorization endpoint caching, so that authorization requests
/// Enables authorization request caching, so that authorization requests
/// are automatically stored in the distributed cache, which allows flowing
/// large payloads across requests. Enabling this option is recommended
/// when using external authentication providers or when large GET or POST
/// OpenID Connect authorization requests support is required.
/// </summary>
/// <returns>The <see cref="OpenIddictServerOwinBuilder"/>.</returns>
public OpenIddictServerOwinBuilder EnableAuthorizationEndpointCaching()
=> Configure(options => options.EnableAuthorizationEndpointCaching = true);
public OpenIddictServerOwinBuilder EnableAuthorizationRequestCaching()
=> Configure(options => options.EnableAuthorizationRequestCaching = true);
/// <summary>
/// Enables logout endpoint caching, so that logout requests
/// Enables logout request caching, so that logout requests
/// are automatically stored in the distributed cache.
/// </summary>
/// <returns>The <see cref="OpenIddictServerOwinBuilder"/>.</returns>
public OpenIddictServerOwinBuilder EnableLogoutEndpointCaching()
=> Configure(options => options.EnableLogoutEndpointCaching = true);
public OpenIddictServerOwinBuilder EnableLogoutRequestCaching()
=> Configure(options => options.EnableLogoutRequestCaching = true);
/// <summary>
/// Sets the realm returned to the caller as part of the WWW-Authenticate header.
@ -159,14 +159,14 @@ namespace Microsoft.Extensions.DependencyInjection
/// </summary>
/// <param name="policy">The caching policy.</param>
/// <returns>The <see cref="OpenIddictServerOwinBuilder"/>.</returns>
public OpenIddictServerOwinBuilder SetAuthorizationEndpointCachingPolicy(DistributedCacheEntryOptions policy)
public OpenIddictServerOwinBuilder SetAuthorizationRequestCachingPolicy(DistributedCacheEntryOptions policy)
{
if (policy is null)
{
throw new ArgumentNullException(nameof(policy));
}
return Configure(options => options.AuthorizationEndpointCachingPolicy = policy);
return Configure(options => options.AuthorizationRequestCachingPolicy = policy);
}
/// <summary>
@ -175,14 +175,14 @@ namespace Microsoft.Extensions.DependencyInjection
/// </summary>
/// <param name="policy">The caching policy.</param>
/// <returns>The <see cref="OpenIddictServerOwinBuilder"/>.</returns>
public OpenIddictServerOwinBuilder SetLogoutEndpointCachingPolicy(DistributedCacheEntryOptions policy)
public OpenIddictServerOwinBuilder SetLogoutRequestCachingPolicy(DistributedCacheEntryOptions policy)
{
if (policy is null)
{
throw new ArgumentNullException(nameof(policy));
}
return Configure(options => options.LogoutEndpointCachingPolicy = policy);
return Configure(options => options.LogoutRequestCachingPolicy = policy);
}
/// <inheritdoc/>

4
src/OpenIddict.Server.Owin/OpenIddictServerOwinExtensions.cs

@ -45,10 +45,10 @@ namespace Microsoft.Extensions.DependencyInjection
builder.Services.TryAdd(DefaultHandlers.Select(descriptor => descriptor.ServiceDescriptor));
// Register the built-in filters used by the default OpenIddict OWIN server event handlers.
builder.Services.TryAddSingleton<RequireAuthorizationEndpointCachingEnabled>();
builder.Services.TryAddSingleton<RequireAuthorizationRequestCachingEnabled>();
builder.Services.TryAddSingleton<RequireAuthorizationEndpointPassthroughEnabled>();
builder.Services.TryAddSingleton<RequireErrorPassthroughEnabled>();
builder.Services.TryAddSingleton<RequireLogoutEndpointCachingEnabled>();
builder.Services.TryAddSingleton<RequireLogoutRequestCachingEnabled>();
builder.Services.TryAddSingleton<RequireLogoutEndpointPassthroughEnabled>();
builder.Services.TryAddSingleton<RequireTransportSecurityRequirementEnabled>();
builder.Services.TryAddSingleton<RequireOwinRequest>();

16
src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlerFilters.cs

@ -18,13 +18,13 @@ namespace OpenIddict.Server.Owin
public static class OpenIddictServerOwinHandlerFilters
{
/// <summary>
/// Represents a filter that excludes the associated handlers if authorization endpoint caching was not enabled.
/// Represents a filter that excludes the associated handlers if authorization request caching was not enabled.
/// </summary>
public class RequireAuthorizationEndpointCachingEnabled : IOpenIddictServerHandlerFilter<BaseContext>
public class RequireAuthorizationRequestCachingEnabled : IOpenIddictServerHandlerFilter<BaseContext>
{
private readonly IOptionsMonitor<OpenIddictServerOwinOptions> _options;
public RequireAuthorizationEndpointCachingEnabled(IOptionsMonitor<OpenIddictServerOwinOptions> options)
public RequireAuthorizationRequestCachingEnabled(IOptionsMonitor<OpenIddictServerOwinOptions> options)
=> _options = options;
public ValueTask<bool> IsActiveAsync(BaseContext context)
@ -34,7 +34,7 @@ namespace OpenIddict.Server.Owin
throw new ArgumentNullException(nameof(context));
}
return new ValueTask<bool>(_options.CurrentValue.EnableAuthorizationEndpointCaching);
return new ValueTask<bool>(_options.CurrentValue.EnableAuthorizationRequestCaching);
}
}
@ -82,13 +82,13 @@ namespace OpenIddict.Server.Owin
}
/// <summary>
/// Represents a filter that excludes the associated handlers if logout endpoint caching was not enabled.
/// Represents a filter that excludes the associated handlers if logout request caching was not enabled.
/// </summary>
public class RequireLogoutEndpointCachingEnabled : IOpenIddictServerHandlerFilter<BaseContext>
public class RequireLogoutRequestCachingEnabled : IOpenIddictServerHandlerFilter<BaseContext>
{
private readonly IOptionsMonitor<OpenIddictServerOwinOptions> _options;
public RequireLogoutEndpointCachingEnabled(IOptionsMonitor<OpenIddictServerOwinOptions> options)
public RequireLogoutRequestCachingEnabled(IOptionsMonitor<OpenIddictServerOwinOptions> options)
=> _options = options;
public ValueTask<bool> IsActiveAsync(BaseContext context)
@ -98,7 +98,7 @@ namespace OpenIddict.Server.Owin
throw new ArgumentNullException(nameof(context));
}
return new ValueTask<bool>(_options.CurrentValue.EnableLogoutEndpointCaching);
return new ValueTask<bool>(_options.CurrentValue.EnableLogoutRequestCaching);
}
}

8
src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.Authentication.cs

@ -80,7 +80,7 @@ namespace OpenIddict.Server.Owin
public static OpenIddictServerHandlerDescriptor Descriptor { get; }
= OpenIddictServerHandlerDescriptor.CreateBuilder<ExtractAuthorizationRequestContext>()
.AddFilter<RequireOwinRequest>()
.AddFilter<RequireAuthorizationEndpointCachingEnabled>()
.AddFilter<RequireAuthorizationRequestCachingEnabled>()
.UseSingletonHandler<RestoreCachedRequestParameters>()
.SetOrder(ExtractGetOrPostRequest<ExtractAuthorizationRequestContext>.Descriptor.Order + 1_000)
.SetType(OpenIddictServerHandlerType.BuiltIn)
@ -181,7 +181,7 @@ namespace OpenIddict.Server.Owin
public static OpenIddictServerHandlerDescriptor Descriptor { get; }
= OpenIddictServerHandlerDescriptor.CreateBuilder<ExtractAuthorizationRequestContext>()
.AddFilter<RequireOwinRequest>()
.AddFilter<RequireAuthorizationEndpointCachingEnabled>()
.AddFilter<RequireAuthorizationRequestCachingEnabled>()
.UseSingletonHandler<CacheRequestParameters>()
.SetOrder(RestoreCachedRequestParameters.Descriptor.Order + 1_000)
.SetType(OpenIddictServerHandlerType.BuiltIn)
@ -246,7 +246,7 @@ namespace OpenIddict.Server.Owin
// Note: the cache key is always prefixed with a specific marker
// to avoid collisions with the other types of cached payloads.
await _cache.SetStringAsync(Cache.AuthorizationRequest + context.Request.RequestId,
token, _options.CurrentValue.AuthorizationEndpointCachingPolicy);
token, _options.CurrentValue.AuthorizationRequestCachingPolicy);
// Create a new GET authorization request containing only the request_id parameter.
var address = WebUtilities.AddQueryString(
@ -280,7 +280,7 @@ namespace OpenIddict.Server.Owin
public static OpenIddictServerHandlerDescriptor Descriptor { get; }
= OpenIddictServerHandlerDescriptor.CreateBuilder<ApplyAuthorizationResponseContext>()
.AddFilter<RequireOwinRequest>()
.AddFilter<RequireAuthorizationEndpointCachingEnabled>()
.AddFilter<RequireAuthorizationRequestCachingEnabled>()
.UseSingletonHandler<RemoveCachedRequest>()
.SetOrder(int.MinValue + 100_000)
.SetType(OpenIddictServerHandlerType.BuiltIn)

8
src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.Session.cs

@ -78,7 +78,7 @@ namespace OpenIddict.Server.Owin
public static OpenIddictServerHandlerDescriptor Descriptor { get; }
= OpenIddictServerHandlerDescriptor.CreateBuilder<ExtractLogoutRequestContext>()
.AddFilter<RequireOwinRequest>()
.AddFilter<RequireLogoutEndpointCachingEnabled>()
.AddFilter<RequireLogoutRequestCachingEnabled>()
.UseSingletonHandler<RestoreCachedRequestParameters>()
.SetOrder(ExtractGetOrPostRequest<ExtractLogoutRequestContext>.Descriptor.Order + 1_000)
.SetType(OpenIddictServerHandlerType.BuiltIn)
@ -179,7 +179,7 @@ namespace OpenIddict.Server.Owin
public static OpenIddictServerHandlerDescriptor Descriptor { get; }
= OpenIddictServerHandlerDescriptor.CreateBuilder<ExtractLogoutRequestContext>()
.AddFilter<RequireOwinRequest>()
.AddFilter<RequireLogoutEndpointCachingEnabled>()
.AddFilter<RequireLogoutRequestCachingEnabled>()
.UseSingletonHandler<CacheRequestParameters>()
.SetOrder(RestoreCachedRequestParameters.Descriptor.Order + 1_000)
.SetType(OpenIddictServerHandlerType.BuiltIn)
@ -244,7 +244,7 @@ namespace OpenIddict.Server.Owin
// Note: the cache key is always prefixed with a specific marker
// to avoid collisions with the other types of cached payloads.
await _cache.SetStringAsync(Cache.LogoutRequest + context.Request.RequestId,
token, _options.CurrentValue.LogoutEndpointCachingPolicy);
token, _options.CurrentValue.LogoutRequestCachingPolicy);
// Create a new GET logout request containing only the request_id parameter.
var address = WebUtilities.AddQueryString(
@ -278,7 +278,7 @@ namespace OpenIddict.Server.Owin
public static OpenIddictServerHandlerDescriptor Descriptor { get; }
= OpenIddictServerHandlerDescriptor.CreateBuilder<ApplyLogoutResponseContext>()
.AddFilter<RequireOwinRequest>()
.AddFilter<RequireLogoutEndpointCachingEnabled>()
.AddFilter<RequireLogoutRequestCachingEnabled>()
.UseSingletonHandler<RemoveCachedRequest>()
.SetOrder(int.MinValue + 100_000)
.SetType(OpenIddictServerHandlerType.BuiltIn)

8
src/OpenIddict.Server.Owin/OpenIddictServerOwinOptions.cs

@ -85,13 +85,13 @@ namespace OpenIddict.Server.Owin
/// Enabling this option is recommended when using external authentication providers
/// or when large GET or POST OpenID Connect authorization requests support is required.
/// </summary>
public bool EnableAuthorizationEndpointCaching { get; set; }
public bool EnableAuthorizationRequestCaching { get; set; }
/// <summary>
/// Gets or sets a boolean indicating whether requests received by the logout endpoint should be cached.
/// When enabled, authorization requests are automatically stored in the distributed cache.
/// </summary>
public bool EnableLogoutEndpointCaching { get; set; }
public bool EnableLogoutRequestCaching { get; set; }
/// <summary>
/// Gets or sets the optional "realm" value returned to the caller as part of the WWW-Authenticate header.
@ -101,7 +101,7 @@ namespace OpenIddict.Server.Owin
/// <summary>
/// Gets or sets the caching policy used by the authorization endpoint.
/// </summary>
public DistributedCacheEntryOptions AuthorizationEndpointCachingPolicy { get; set; } = new DistributedCacheEntryOptions
public DistributedCacheEntryOptions AuthorizationRequestCachingPolicy { get; set; } = new DistributedCacheEntryOptions
{
AbsoluteExpirationRelativeToNow = TimeSpan.FromHours(1),
SlidingExpiration = TimeSpan.FromMinutes(30)
@ -110,7 +110,7 @@ namespace OpenIddict.Server.Owin
/// <summary>
/// Gets or sets the caching policy used by the logout endpoint.
/// </summary>
public DistributedCacheEntryOptions LogoutEndpointCachingPolicy { get; set; } = new DistributedCacheEntryOptions
public DistributedCacheEntryOptions LogoutRequestCachingPolicy { get; set; } = new DistributedCacheEntryOptions
{
AbsoluteExpirationRelativeToNow = TimeSpan.FromHours(1),
SlidingExpiration = TimeSpan.FromMinutes(30)

2
test/OpenIddict.Server.AspNetCore.IntegrationTests/OpenIddictServerAspNetCoreIntegrationTests.Authentication.cs

@ -43,7 +43,7 @@ namespace OpenIddict.Server.AspNetCore.IntegrationTests
options.Services.AddDistributedMemoryCache();
options.UseAspNetCore()
.EnableAuthorizationEndpointCaching();
.EnableAuthorizationRequestCaching();
});
await using var client = await server.CreateClientAsync();

2
test/OpenIddict.Server.AspNetCore.IntegrationTests/OpenIddictServerAspNetCoreIntegrationTests.Session.cs

@ -43,7 +43,7 @@ namespace OpenIddict.Server.AspNetCore.IntegrationTests
options.Services.AddDistributedMemoryCache();
options.UseAspNetCore()
.EnableLogoutEndpointCaching();
.EnableLogoutRequestCaching();
});
await using var client = await server.CreateClientAsync();

2
test/OpenIddict.Server.Owin.IntegrationTests/OpenIddictServerOwinIntegrationTests.Authentication.cs

@ -43,7 +43,7 @@ namespace OpenIddict.Server.Owin.IntegrationTests
options.Services.AddDistributedMemoryCache();
options.UseOwin()
.EnableAuthorizationEndpointCaching();
.EnableAuthorizationRequestCaching();
});
await using var client = await server.CreateClientAsync();

2
test/OpenIddict.Server.Owin.IntegrationTests/OpenIddictServerOwinIntegrationTests.Session.cs

@ -43,7 +43,7 @@ namespace OpenIddict.Server.Owin.IntegrationTests
options.Services.AddDistributedMemoryCache();
options.UseOwin()
.EnableLogoutEndpointCaching();
.EnableLogoutRequestCaching();
});
await using var client = await server.CreateClientAsync();

Loading…
Cancel
Save