Authorization Policy

A named rule about who is allowed to do something.

What is Authorization Policy?

An authorization policy is a named rule about who may do something, such as "must have the Admin role" or "must be at least Basic tier".

builder.Services.AddAuthorization(o =>
    o.AddPolicy("Admin", p => p.RequireRole("Admin")));

app.MapDelete("/recipes/{id:int}", Delete).RequireAuthorization("Admin");

Level: Journeyman · More ASP.NET Core terms at this level

Updated