jezzsantos / saastack

A comprehensive codebase template for starting your real-world, fully featured SaaS web products. On the .NET platform
The Unlicense
36 stars 9 forks source link

Role & FeatureLevel based authorization #20

Closed jezzsantos closed 8 months ago

jezzsantos commented 8 months ago

We want the developer to be able to be declarative in coarse grained roles-based and feature-based authorization for endpoints.

At this stage, we are not designing for fine-grained permissions or policies.

We already define a small number of Authorization policies using net7.0 minimal API authorization policies but those policies are not easily extendable to be used in declarative ways.

All of our Roles and FeatureLevels are already very discrete and can be turned into enumerations (either in code directly or using source generators)

Once we have that and some declarative syntax to markup service operations (i.e., an extension to the RouteAttribute) or another mechanism, we can make the declarative syntax very easy.

One such approach is outlined here: https://www.linkedin.com/pulse/permission-based-authorization-aspnet-7-minimal-apis-yago-vicent/

jezzsantos commented 8 months ago
jezzsantos commented 8 months ago

Resolving problem with including Roslyn generated code in the Roslyn generator: https://andrewlock.net/creating-a-source-generator-part-6-saving-source-generator-output-in-source-control/