How to integrate authentication/authorization middleware?
app.UseAuthentication(); // Validates user identity
app.UseAuthorization(); // Applies policies/roles
Order matters: must be after routing but before endpoints.
app.UseRouting();
app.UseAuthentication();
app.UseAuthorization();
app.UseEndpoints(...);