Example #1
0
 /// <summary>
 /// Creates a new instance of the context object.
 /// </summary>
 /// <param name="context">The HTTP request context</param>
 /// <param name="options">The middleware options</param>
 /// <param name="exception">The exception thrown.</param>
 /// <param name="ticket">The current ticket, if any.</param>
 public BasicExceptionContext(
     HttpContext context,
     BasicOptions options,
     Exception exception)
     : base(context)
 {
     Exception = exception;
 }
Example #2
0
		public BaseBasicContext(HttpContext context, BasicOptions options)
			: base(context)
		{
			if (options == null)
				throw new ArgumentNullException(nameof(options));

			Options = options;
		}
Example #3
0
 internal void SaveSetting(BasicOptions options)
 {
     if (SettingPath == null || SettingPath.Length == 0)
     {
         // TODO: もう少しエレガントな方法は無いものか
         SettingPath =
             Path.Combine(Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location), DefaultSettingFile);
     }
     options.Save(SettingPath);
 }
		/// <summary>
		/// Adds a basic authentication middleware to your web application pipeline.  This method does not attempt to obtain options though `IOptions`.
		/// </summary>
		/// <param name="app">The IApplicationBuilder passed to your configuration method</param>
		/// <param name="options">Used to configure the middleware</param>
		/// <returns>The original app parameter</returns>
		public static IApplicationBuilder UseBasicAuthentication(this IApplicationBuilder app, BasicOptions options)
        {
            if (app == null)
                throw new ArgumentNullException(nameof(app));

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

            return app.UseMiddleware<BasicMiddleware>(options);
        }
Example #5
0
 /// <summary>
 /// Creates a new instance of the context object.
 /// </summary>
 /// <param name="context">The HTTP request context</param>
 /// <param name="options">The middleware options</param>
 /// <param name="username">The username</param>
 /// <param name="password">The password</param>
 public BasicSignInContext(
     HttpContext context,
     BasicOptions options,
     string username,
     string password
 )
     : base(context, options)
 {
     Username = username;
     Password = password;
 }
		/// <summary>
		/// Adds a basic authentication middleware to your web application pipeline. This method does not attempt to obtain options though `IOptions`.
		/// </summary>
		/// <param name="app">The IApplicationBuilder passed to your configuration method</param>
		/// <param name="configureOptions">Used to configure the options for the middleware</param>
		/// <returns>The original app parameter</returns>
		public static IApplicationBuilder UseBasicAuthentication(this IApplicationBuilder app, Action<BasicOptions> configureOptions)
        {
            if (app == null)
                throw new ArgumentNullException(nameof(app));

            var options = new BasicOptions();
            if (configureOptions != null)
                configureOptions(options);

            return app.UseBasicAuthentication(options);
        }
Example #7
0
 public void Save(BasicOptions opt)
 {
     x11.SaveSetting(opt);
 }