Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,7 @@ public sealed partial class OpenIddictClientWebIntegrationBuilder
{{~ end ~}}
public OpenIddictClientWebIntegrationBuilder Add{{ provider.name }}(Action<OpenIddictClientWebIntegrationBuilder.{{ provider.name }}> configuration)
{
if (configuration is null)
{
throw new ArgumentNullException(nameof(configuration));
}
ArgumentNullException.ThrowIfNull(configuration);

Services.Configure<OpenIddictClientOptions>(options =>
{
Expand Down Expand Up @@ -132,10 +129,7 @@ public sealed partial class {{ provider.name }}
[EditorBrowsable(EditorBrowsableState.Advanced)]
public {{ provider.name }} AddClientAuthenticationMethods(params string[] methods)
{
if (methods is null)
{
throw new ArgumentNullException(nameof(methods));
}
ArgumentNullException.ThrowIfNull(methods);

return Set(registration => registration.ClientAuthenticationMethods.UnionWith(methods));
}
Expand All @@ -149,10 +143,7 @@ public sealed partial class {{ provider.name }}
[EditorBrowsable(EditorBrowsableState.Advanced)]
public {{ provider.name }} AddCodeChallengeMethods(params string[] methods)
{
if (methods is null)
{
throw new ArgumentNullException(nameof(methods));
}
ArgumentNullException.ThrowIfNull(methods);

return Set(registration => registration.CodeChallengeMethods.UnionWith(methods));
}
Expand All @@ -166,10 +157,7 @@ public sealed partial class {{ provider.name }}
[EditorBrowsable(EditorBrowsableState.Advanced)]
public {{ provider.name }} AddGrantTypes(params string[] types)
{
if (types is null)
{
throw new ArgumentNullException(nameof(types));
}
ArgumentNullException.ThrowIfNull(types);

return Set(registration => registration.GrantTypes.UnionWith(types));
}
Expand All @@ -183,10 +171,7 @@ public sealed partial class {{ provider.name }}
[EditorBrowsable(EditorBrowsableState.Advanced)]
public {{ provider.name }} AddResponseModes(params string[] modes)
{
if (modes is null)
{
throw new ArgumentNullException(nameof(modes));
}
ArgumentNullException.ThrowIfNull(modes);

return Set(registration => registration.ResponseModes.UnionWith(modes));
}
Expand All @@ -200,10 +185,7 @@ public sealed partial class {{ provider.name }}
[EditorBrowsable(EditorBrowsableState.Advanced)]
public {{ provider.name }} AddResponseTypes(params string[] types)
{
if (types is null)
{
throw new ArgumentNullException(nameof(types));
}
ArgumentNullException.ThrowIfNull(types);

return Set(registration => registration.ResponseTypes.UnionWith(types));
}
Expand All @@ -215,10 +197,7 @@ public sealed partial class {{ provider.name }}
/// <returns>The <see cref=""OpenIddictClientWebIntegrationBuilder.{{ provider.name }}""/> instance.</returns>
public {{ provider.name }} AddScopes(params string[] scopes)
{
if (scopes is null)
{
throw new ArgumentNullException(nameof(scopes));
}
ArgumentNullException.ThrowIfNull(scopes);

return Set(registration => registration.Scopes.UnionWith(scopes));
}
Expand Down
10 changes: 2 additions & 8 deletions src/OpenIddict.Client.Owin/OpenIddictClientOwinBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,7 @@ public OpenIddictClientOwinBuilder(IServiceCollection services)
/// <returns>The <see cref="OpenIddictClientOwinBuilder"/> instance.</returns>
public OpenIddictClientOwinBuilder Configure(Action<OpenIddictClientOwinOptions> configuration)
{
if (configuration is null)
{
throw new ArgumentNullException(nameof(configuration));
}
ArgumentNullException.ThrowIfNull(configuration);

Services.Configure(configuration);

Expand Down Expand Up @@ -137,10 +134,7 @@ public OpenIddictClientOwinBuilder EnableErrorPassthrough()
/// <returns>The <see cref="OpenIddictClientOwinBuilder"/> instance.</returns>
public OpenIddictClientOwinBuilder SetCookieManager(ICookieManager manager)
{
if (manager is null)
{
throw new ArgumentNullException(nameof(manager));
}
ArgumentNullException.ThrowIfNull(manager);

return Configure(options => options.CookieManager = manager);
}
Expand Down
10 changes: 2 additions & 8 deletions src/OpenIddict.Client.Owin/OpenIddictClientOwinConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,7 @@ public OpenIddictClientOwinConfiguration(IServiceProvider provider)
/// <inheritdoc/>
public void Configure(OpenIddictClientOptions options)
{
if (options is null)
{
throw new ArgumentNullException(nameof(options));
}
ArgumentNullException.ThrowIfNull(options);

// Register the built-in event handlers used by the OpenIddict OWIN Client components.
options.Handlers.AddRange(OpenIddictClientOwinHandlers.DefaultHandlers);
Expand All @@ -42,10 +39,7 @@ public void Configure(OpenIddictClientOptions options)
/// <inheritdoc/>
public void PostConfigure(string? name, OpenIddictClientOwinOptions options)
{
if (options is null)
{
throw new ArgumentNullException(nameof(options));
}
ArgumentNullException.ThrowIfNull(options);

// If no cookie manager was explicitly configured but the OWIN application builder was registered as a service
// (which is required when using Autofac with the built-in Katana authentication middleware, as they require
Expand Down
16 changes: 3 additions & 13 deletions src/OpenIddict.Client.Owin/OpenIddictClientOwinExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,7 @@ public static class OpenIddictClientOwinExtensions
/// <returns>The <see cref="OpenIddictClientOwinBuilder"/> instance.</returns>
public static OpenIddictClientOwinBuilder UseOwin(this OpenIddictClientBuilder builder)
{
if (builder is null)
{
throw new ArgumentNullException(nameof(builder));
}
ArgumentNullException.ThrowIfNull(builder);

builder.Services.AddWebEncoders();

Expand Down Expand Up @@ -68,15 +65,8 @@ public static OpenIddictClientOwinBuilder UseOwin(this OpenIddictClientBuilder b
public static OpenIddictClientBuilder UseOwin(
this OpenIddictClientBuilder builder, Action<OpenIddictClientOwinBuilder> configuration)
{
if (builder is null)
{
throw new ArgumentNullException(nameof(builder));
}

if (configuration is null)
{
throw new ArgumentNullException(nameof(configuration));
}
ArgumentNullException.ThrowIfNull(builder);
ArgumentNullException.ThrowIfNull(configuration);

configuration(builder.UseOwin());

Expand Down
25 changes: 5 additions & 20 deletions src/OpenIddict.Client.Owin/OpenIddictClientOwinHandlerFilters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,7 @@ public RequirePostLogoutRedirectionEndpointPassthroughEnabled(IOptionsMonitor<Op
/// <inheritdoc/>
public ValueTask<bool> IsActiveAsync(BaseContext context)
{
if (context is null)
{
throw new ArgumentNullException(nameof(context));
}
ArgumentNullException.ThrowIfNull(context);

return new(_options.CurrentValue.EnablePostLogoutRedirectionEndpointPassthrough);
}
Expand All @@ -53,10 +50,7 @@ public RequireRedirectionEndpointPassthroughEnabled(IOptionsMonitor<OpenIddictCl
/// <inheritdoc/>
public ValueTask<bool> IsActiveAsync(BaseContext context)
{
if (context is null)
{
throw new ArgumentNullException(nameof(context));
}
ArgumentNullException.ThrowIfNull(context);

return new(_options.CurrentValue.EnableRedirectionEndpointPassthrough);
}
Expand All @@ -75,10 +69,7 @@ public RequireErrorPassthroughEnabled(IOptionsMonitor<OpenIddictClientOwinOption
/// <inheritdoc/>
public ValueTask<bool> IsActiveAsync(BaseContext context)
{
if (context is null)
{
throw new ArgumentNullException(nameof(context));
}
ArgumentNullException.ThrowIfNull(context);

return new(_options.CurrentValue.EnableErrorPassthrough);
}
Expand All @@ -92,10 +83,7 @@ public sealed class RequireOwinRequest : IOpenIddictClientHandlerFilter<BaseCont
/// <inheritdoc/>
public ValueTask<bool> IsActiveAsync(BaseContext context)
{
if (context is null)
{
throw new ArgumentNullException(nameof(context));
}
ArgumentNullException.ThrowIfNull(context);

return new(context.Transaction.GetOwinRequest() is not null);
}
Expand All @@ -114,10 +102,7 @@ public RequireTransportSecurityRequirementEnabled(IOptionsMonitor<OpenIddictClie
/// <inheritdoc/>
public ValueTask<bool> IsActiveAsync(BaseContext context)
{
if (context is null)
{
throw new ArgumentNullException(nameof(context));
}
ArgumentNullException.ThrowIfNull(context);

return new(!_options.CurrentValue.DisableTransportSecurityRequirement);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*/

using System.Collections.Immutable;
using Microsoft.Extensions.Options;
using Owin;

namespace OpenIddict.Client.Owin;
Expand Down Expand Up @@ -61,10 +62,7 @@ public sealed class ProcessQueryRequest : IOpenIddictClientHandler<ApplyAuthoriz
/// <inheritdoc/>
public ValueTask HandleAsync(ApplyAuthorizationRequestContext context)
{
if (context is null)
{
throw new ArgumentNullException(nameof(context));
}
ArgumentNullException.ThrowIfNull(context);

// This handler only applies to OWIN requests. If the HTTP context cannot be resolved,
// this may indicate that the request was incorrectly processed by another server stack.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,7 @@ public sealed class ProcessQueryRequest : IOpenIddictClientHandler<ApplyEndSessi
/// <inheritdoc/>
public ValueTask HandleAsync(ApplyEndSessionRequestContext context)
{
if (context is null)
{
throw new ArgumentNullException(nameof(context));
}
ArgumentNullException.ThrowIfNull(context);

// This handler only applies to OWIN requests. If the HTTP context cannot be resolved,
// this may indicate that the request was incorrectly processed by another server stack.
Expand Down
Loading