Пример #1
0
        public UrlAuthorizationMiddleware(RequestDelegate next, UrlAuthorizatonOptions options)
        {
            if (next == null)
            {
                throw new ArgumentNullException(nameof(next));
            }

            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            if (string.IsNullOrEmpty(options.Path))
            {
                throw new ArgumentNullException(nameof(options.Path));
            }

            _next    = next;
            _options = options;
        }
Пример #2
0
 public static IApplicationBuilder UseUrlAuthorization(this IApplicationBuilder builder, UrlAuthorizatonOptions options)
 {
     return(builder.UseMiddleware <UrlAuthorizationMiddleware>(options));
 }