© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
13 replies
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
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")]
[Authorize("myPolicy")]
on my api endpoints.
If the feature is disabled I don't even register any auth related services or middlewares.
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

What feature flag platform do you recommend?
C#CC# / help
2y ago
❔ Getting Identity from [Authorize]
C#CC# / help
3y ago
Asp Net Core Authorize Attribute
C#CC# / help
4y ago