Standardizing middleware to use configureOptions lambda
This commit is contained in:
parent
f3f7027438
commit
6d202b0fdf
|
|
@ -12,7 +12,7 @@ namespace Microsoft.AspNet.Builder
|
||||||
/// Adds middleware for interacting with the IIS HttpPlatformHandler reverse proxy module.
|
/// Adds middleware for interacting with the IIS HttpPlatformHandler reverse proxy module.
|
||||||
/// This will handle forwarded Windows Authentication, request scheme, remote IPs, etc..
|
/// This will handle forwarded Windows Authentication, request scheme, remote IPs, etc..
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="builder"></param>
|
/// <param name="app"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static IApplicationBuilder UseIISPlatformHandler(this IApplicationBuilder app)
|
public static IApplicationBuilder UseIISPlatformHandler(this IApplicationBuilder app)
|
||||||
{
|
{
|
||||||
|
|
@ -21,34 +21,15 @@ namespace Microsoft.AspNet.Builder
|
||||||
throw new ArgumentNullException(nameof(app));
|
throw new ArgumentNullException(nameof(app));
|
||||||
}
|
}
|
||||||
|
|
||||||
return app.UseMiddleware<IISPlatformHandlerMiddleware>(new IISPlatformHandlerOptions());
|
return app.UseIISPlatformHandler(options => { });
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Adds middleware for interacting with the IIS HttpPlatformHandler reverse proxy module.
|
/// Adds middleware for interacting with the IIS HttpPlatformHandler reverse proxy module.
|
||||||
/// This will handle forwarded Windows Authentication, request scheme, remote IPs, etc..
|
/// This will handle forwarded Windows Authentication, request scheme, remote IPs, etc..
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="builder"></param>
|
/// <param name="app"></param>
|
||||||
/// <returns></returns>
|
/// <param name="configureOptions"></param>
|
||||||
public static IApplicationBuilder UseIISPlatformHandler(this IApplicationBuilder app, IISPlatformHandlerOptions options)
|
|
||||||
{
|
|
||||||
if (app == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(app));
|
|
||||||
}
|
|
||||||
if (options == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(options));
|
|
||||||
}
|
|
||||||
|
|
||||||
return app.UseMiddleware<IISPlatformHandlerMiddleware>(options);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Adds middleware for interacting with the IIS HttpPlatformHandler reverse proxy module.
|
|
||||||
/// This will handle forwarded Windows Authentication, request scheme, remote IPs, etc..
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="builder"></param>
|
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static IApplicationBuilder UseIISPlatformHandler(this IApplicationBuilder app, Action<IISPlatformHandlerOptions> configureOptions)
|
public static IApplicationBuilder UseIISPlatformHandler(this IApplicationBuilder app, Action<IISPlatformHandlerOptions> configureOptions)
|
||||||
{
|
{
|
||||||
|
|
@ -56,6 +37,10 @@ namespace Microsoft.AspNet.Builder
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(app));
|
throw new ArgumentNullException(nameof(app));
|
||||||
}
|
}
|
||||||
|
if (configureOptions == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(configureOptions));
|
||||||
|
}
|
||||||
|
|
||||||
var options = new IISPlatformHandlerOptions();
|
var options = new IISPlatformHandlerOptions();
|
||||||
if (configureOptions != null)
|
if (configureOptions != null)
|
||||||
|
|
@ -63,7 +48,7 @@ namespace Microsoft.AspNet.Builder
|
||||||
configureOptions(options);
|
configureOptions(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
return app.UseIISPlatformHandler(options);
|
return app.UseMiddleware<IISPlatformHandlerMiddleware>(options);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue