|
|
|
@ -783,7 +783,7 @@ namespace OpenIddict.Server.AspNetCore |
|
|
|
= OpenIddictServerHandlerDescriptor.CreateBuilder<TContext>() |
|
|
|
.AddFilter<RequireHttpRequest>() |
|
|
|
.UseSingletonHandler<AttachHttpResponseCode<TContext>>() |
|
|
|
.SetOrder(AttachCacheControlHeader<TContext>.Descriptor.Order - 1_000) |
|
|
|
.SetOrder(100_000) |
|
|
|
.SetType(OpenIddictServerHandlerType.BuiltIn) |
|
|
|
.Build(); |
|
|
|
|
|
|
|
@ -843,7 +843,7 @@ namespace OpenIddict.Server.AspNetCore |
|
|
|
= OpenIddictServerHandlerDescriptor.CreateBuilder<TContext>() |
|
|
|
.AddFilter<RequireHttpRequest>() |
|
|
|
.UseSingletonHandler<AttachCacheControlHeader<TContext>>() |
|
|
|
.SetOrder(AttachWwwAuthenticateHeader<TContext>.Descriptor.Order - 1_000) |
|
|
|
.SetOrder(AttachHttpResponseCode<TContext>.Descriptor.Order + 1_000) |
|
|
|
.SetType(OpenIddictServerHandlerType.BuiltIn) |
|
|
|
.Build(); |
|
|
|
|
|
|
|
@ -890,7 +890,7 @@ namespace OpenIddict.Server.AspNetCore |
|
|
|
= OpenIddictServerHandlerDescriptor.CreateBuilder<TContext>() |
|
|
|
.AddFilter<RequireHttpRequest>() |
|
|
|
.UseSingletonHandler<AttachWwwAuthenticateHeader<TContext>>() |
|
|
|
.SetOrder(ProcessChallengeErrorResponse<TContext>.Descriptor.Order - 1_000) |
|
|
|
.SetOrder(AttachCacheControlHeader<TContext>.Descriptor.Order + 1_000) |
|
|
|
.SetType(OpenIddictServerHandlerType.BuiltIn) |
|
|
|
.Build(); |
|
|
|
|
|
|
|
@ -1004,7 +1004,7 @@ namespace OpenIddict.Server.AspNetCore |
|
|
|
= OpenIddictServerHandlerDescriptor.CreateBuilder<TContext>() |
|
|
|
.AddFilter<RequireHttpRequest>() |
|
|
|
.UseSingletonHandler<ProcessChallengeErrorResponse<TContext>>() |
|
|
|
.SetOrder(ProcessJsonResponse<TContext>.Descriptor.Order - 1_000) |
|
|
|
.SetOrder(AttachWwwAuthenticateHeader<TContext>.Descriptor.Order + 1_000) |
|
|
|
.SetType(OpenIddictServerHandlerType.BuiltIn) |
|
|
|
.Build(); |
|
|
|
|
|
|
|
@ -1050,7 +1050,7 @@ namespace OpenIddict.Server.AspNetCore |
|
|
|
= OpenIddictServerHandlerDescriptor.CreateBuilder<TContext>() |
|
|
|
.AddFilter<RequireHttpRequest>() |
|
|
|
.UseSingletonHandler<ProcessJsonResponse<TContext>>() |
|
|
|
.SetOrder(ProcessPassthroughErrorResponse<TContext, IOpenIddictServerHandlerFilter<TContext>>.Descriptor.Order - 1_000) |
|
|
|
.SetOrder(ProcessChallengeErrorResponse<TContext>.Descriptor.Order + 1_000) |
|
|
|
.SetType(OpenIddictServerHandlerType.BuiltIn) |
|
|
|
.Build(); |
|
|
|
|
|
|
|
@ -1112,7 +1112,7 @@ namespace OpenIddict.Server.AspNetCore |
|
|
|
.AddFilter<RequireErrorPassthroughEnabled>() |
|
|
|
.AddFilter<TFilter>() |
|
|
|
.UseSingletonHandler<ProcessPassthroughErrorResponse<TContext, TFilter>>() |
|
|
|
.SetOrder(ProcessStatusCodePagesErrorResponse<TContext>.Descriptor.Order - 1_000) |
|
|
|
.SetOrder(ProcessJsonResponse<TContext>.Descriptor.Order + 1_000) |
|
|
|
.SetType(OpenIddictServerHandlerType.BuiltIn) |
|
|
|
.Build(); |
|
|
|
|
|
|
|
@ -1160,7 +1160,7 @@ namespace OpenIddict.Server.AspNetCore |
|
|
|
.AddFilter<RequireHttpRequest>() |
|
|
|
.AddFilter<RequireStatusCodePagesIntegrationEnabled>() |
|
|
|
.UseSingletonHandler<ProcessStatusCodePagesErrorResponse<TContext>>() |
|
|
|
.SetOrder(ProcessLocalErrorResponse<TContext>.Descriptor.Order - 1_000) |
|
|
|
.SetOrder(ProcessPassthroughErrorResponse<TContext, IOpenIddictServerHandlerFilter<TContext>>.Descriptor.Order + 1_000) |
|
|
|
.SetType(OpenIddictServerHandlerType.BuiltIn) |
|
|
|
.Build(); |
|
|
|
|
|
|
|
@ -1219,7 +1219,7 @@ namespace OpenIddict.Server.AspNetCore |
|
|
|
= OpenIddictServerHandlerDescriptor.CreateBuilder<TContext>() |
|
|
|
.AddFilter<RequireHttpRequest>() |
|
|
|
.UseSingletonHandler<ProcessLocalErrorResponse<TContext>>() |
|
|
|
.SetOrder(ProcessEmptyResponse<TContext>.Descriptor.Order - 1_000) |
|
|
|
.SetOrder(ProcessStatusCodePagesErrorResponse<TContext>.Descriptor.Order + 1_000) |
|
|
|
.SetType(OpenIddictServerHandlerType.BuiltIn) |
|
|
|
.Build(); |
|
|
|
|
|
|
|
@ -1282,53 +1282,6 @@ namespace OpenIddict.Server.AspNetCore |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Contains the logic responsible of processing empty OpenID Connect responses that should trigger a host redirection.
|
|
|
|
/// Note: this handler is not used when the OpenID Connect request is not initially handled by ASP.NET Core.
|
|
|
|
/// </summary>
|
|
|
|
public class ProcessHostRedirectionResponse<TContext> : IOpenIddictServerHandler<TContext> |
|
|
|
where TContext : BaseRequestContext |
|
|
|
{ |
|
|
|
/// <summary>
|
|
|
|
/// Gets the default descriptor definition assigned to this handler.
|
|
|
|
/// </summary>
|
|
|
|
public static OpenIddictServerHandlerDescriptor Descriptor { get; } |
|
|
|
= OpenIddictServerHandlerDescriptor.CreateBuilder<TContext>() |
|
|
|
.AddFilter<RequireHttpRequest>() |
|
|
|
.UseSingletonHandler<ProcessHostRedirectionResponse<TContext>>() |
|
|
|
.SetOrder(ProcessEmptyResponse<TContext>.Descriptor.Order - 1_000) |
|
|
|
.SetType(OpenIddictServerHandlerType.BuiltIn) |
|
|
|
.Build(); |
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
public ValueTask HandleAsync(TContext context) |
|
|
|
{ |
|
|
|
if (context is null) |
|
|
|
{ |
|
|
|
throw new ArgumentNullException(nameof(context)); |
|
|
|
} |
|
|
|
|
|
|
|
// 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 response = context.Transaction.GetHttpRequest()?.HttpContext.Response; |
|
|
|
if (response is null) |
|
|
|
{ |
|
|
|
throw new InvalidOperationException(SR.GetResourceString(SR.ID0114)); |
|
|
|
} |
|
|
|
|
|
|
|
var properties = context.Transaction.GetProperty<AuthenticationProperties>(typeof(AuthenticationProperties).FullName!); |
|
|
|
if (properties is not null && !string.IsNullOrEmpty(properties.RedirectUri)) |
|
|
|
{ |
|
|
|
response.Redirect(properties.RedirectUri); |
|
|
|
|
|
|
|
context.Logger.LogInformation(SR.GetResourceString(SR.ID6144)); |
|
|
|
context.HandleRequest(); |
|
|
|
} |
|
|
|
|
|
|
|
return default; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Contains the logic responsible of processing OpenID Connect responses that don't specify any parameter.
|
|
|
|
/// Note: this handler is not used when the OpenID Connect request is not initially handled by ASP.NET Core.
|
|
|
|
|