20 lines
773 B
C#
20 lines
773 B
C#
using Microsoft.AspNetCore.Builder;
|
|
|
|
namespace AMWD.Common.AspNetCore.Security.PathProtection
|
|
{
|
|
/// <summary>
|
|
/// Extnsion for <see cref="IApplicationBuilder"/> to enable folder protection.
|
|
/// </summary>
|
|
[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
|
|
public static class ProtectedPathExtensions
|
|
{
|
|
/// <summary>
|
|
/// Provide protected paths even for static files.
|
|
/// </summary>
|
|
/// <param name="app">The <see cref="IApplicationBuilder"/>.</param>
|
|
/// <param name="options">The <see cref="ProtectedPathOptions"/> with path and policy name.</param>
|
|
public static IApplicationBuilder UseProtectedPath(this IApplicationBuilder app, ProtectedPathOptions options)
|
|
=> app.UseMiddleware<ProtectedPathMiddleware>(options);
|
|
}
|
|
}
|