/// <summary>
        /// Adds the <see cref="BattleNetMiddleware"/> middleware to the specified <see cref="IApplicationBuilder"/>, which enables BattleNet authentication capabilities.
        /// </summary>
        /// <param name="app">The <see cref="IApplicationBuilder"/> to add the middleware to.</param>
        /// <param name="options">A <see cref="BattleNetOptions"/> that specifies options for the middleware.</param>
        /// <returns>A reference to this instance after the operation has completed.</returns>
        public static IApplicationBuilder UseBattleNetAuthentication(this IApplicationBuilder app, BattleNetOptions options)
        {
            if (app == null) throw new ArgumentNullException(nameof(app));
            if (options == null) throw new ArgumentNullException(nameof(options));

            return app.UseMiddleware<BattleNetMiddleware>(options);
        }
        /// <summary>
        /// Adds the <see cref="BattleNetMiddleware"/> middleware to the specified <see cref="IApplicationBuilder"/>, which enables BattleNet authentication capabilities.
        /// </summary>
        /// <param name="app">The <see cref="IApplicationBuilder"/> to add the middleware to.</param>
        /// <param name="configureOptions">An action delegate to configure the provided <see cref="BattleNetOptions"/>.</param>
        /// <returns>A reference to this instance after the operation has completed.</returns>
        public static IApplicationBuilder UseBattleNetAuthentication(this IApplicationBuilder app, Action<BattleNetOptions> configureOptions)
        {
            if (app == null) throw new ArgumentNullException(nameof(app));

            var options = new BattleNetOptions();
            configureOptions?.Invoke(options);
            return app.UseBattleNetAuthentication(options);
        }
Пример #3
0
 /// <summary>
 /// Initializes a new <see cref="BattleNetAuthenticationMessageHandler"/>
 /// </summary>
 /// <param name="options"></param>
 public BattleNetAuthenticationMessageHandler(BattleNetOptions options)
 {
     if (options == null) throw new ArgumentNullException(nameof(options));
     _options = options;
 }