0

I have an ASP.NET Core Web API project that requires X-API-Key for all controllers.

Additionally, in some controllers I need to identify (authenticate) user. I want to use basic authentication.

How do I combine multiple authentication schemes using a logical AND?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Liero
  • 25,216
  • 29
  • 151
  • 297
  • Check out these questions: [How do I setup multiple auth schemes in ASP.NET Core 2.0?](https://stackoverflow.com/q/45695382/8065832) and [Use multiple JWT Bearer Authentication](https://stackoverflow.com/q/49694383/8065832). – Prolog Apr 23 '21 at 20:14
  • @Prolog: Based on the link, I understand that there can be only single policy, that resolves Identity, which is Basic in my case. However, how do I add requirement for X-API-Key alongside the basic auth? I hope I can avoid writing custom middleware – Liero Apr 26 '21 at 07:16

0 Answers0