// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { MyAuth myAuth = new MyAuth(); services.AddAuthentication("Basic").AddScheme <MyOptions, MyAuthHandler>("Basic", null); services.AddSingleton(myAuth); services.AddControllers(); services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new OpenApiInfo { Title = "sampleauth", Version = "v1" }); }); }
public MyAuthHandler(MyAuth myauth, IOptionsMonitor <MyOptions> options, ILoggerFactory logger, UrlEncoder encoder, ISystemClock clock) : base(options, logger, encoder, clock) { this.MyAuth = myauth; }