/// <summary>
        /// Adds the <see cref="BufferAuthenticationMiddleware"/> middleware to the specified
        /// <see cref="IApplicationBuilder"/>, which enables Buffer authentication capabilities.
        /// </summary>
        /// <param name="app">The <see cref="IApplicationBuilder"/> to add the middleware to.</param>
        /// <param name="configuration">An action delegate to configure the provided <see cref="BufferAuthenticationOptions"/>.</param>
        /// <returns>A reference to this instance after the operation has completed.</returns>
        public static IApplicationBuilder UseBufferAuthentication(
            [NotNull] this IApplicationBuilder app,
            [NotNull] Action <BufferAuthenticationOptions> configuration)
        {
            if (app == null)
            {
                throw new ArgumentNullException(nameof(app));
            }

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

            var options = new BufferAuthenticationOptions();

            configuration(options);

            return(app.UseMiddleware <BufferAuthenticationMiddleware>(Options.Create(options)));
        }
Ejemplo n.º 2
0
 public static IApplicationBuilder UseBufferAuthentication(
     [NotNull] this IApplicationBuilder app,
     [NotNull] BufferAuthenticationOptions options)
 {
     return(app.UseMiddleware <BufferAuthenticationMiddleware>(options));
 }