Skip to content
Preptima
mediumScenarioConceptMidSenior

You added an authorisation policy to an ASP.NET Core endpoint and it is not being enforced. Where do you look?

4 min readUpdated 2026-08-15

Answer

Short answer

The pipeline is an ordered list you assembled, and authorisation cannot decide anything before routing has selected an endpoint to decide about. Registered in the wrong order it either runs against nothing or never runs at all, and neither produces an error - the request simply succeeds.

Was this answer helpful?

Likely follow-ups

  • What does UseRouting actually do that UseEndpoints then depends on?
  • Your custom middleware never calls next. What happens to everything after it?
  • Where would you put exception handling, and why there?
  • How would you write a middleware that measures duration correctly?

Related questions

Further reading