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
  • 704,970
  • 168
  • 1,303
  • 1,425
Liero
  • 22,266
  • 22
  • 120
  • 244
  • 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