Resolve dependencies for authentication event handler through DI
问题 I use JWT bearer tokens to protect my ASP.NET Core 2.1 web API. During ConfigureServices , I setup the authentication, and tie in a JwtBeaererEvents object via options for additional processing. I'd like this object to be part of the DI container but I'm not sure how to do that. For now, I have to create instances and pass it through the constructor (anti-pattern). But this is going to create a chicken and an egg scenario: /* HACK */ var sp = services.BuildServiceProvider(); services