C#C
C#3y ago
Dr_Cox1911

✅ Put `[Authorize("myPolicy")]` behind feature flag

Greetings,

I'm currently working on authentication and authorization for an API that is already deployed to a couple of customers. The whole auth process sits behind a feature flag using the MS IFeatureManager, so that the API can be deployed completely without auth and once more downtime is possible from customers side auth shall be activated by enabling this feature.

I have pretty much all covered by the feature flag, but I don't know how I can conditionally apply the [Authorize("myPolicy")] on my api endpoints.
If the feature is disabled I don't even register any auth related services or middlewares.
Was this page helpful?