C#C
C#3y ago
3 replies
JoanGil

❔ Dynamically change Filter to reuse same Controller

Hello!

I have an application that has 2 different logins: one for web apps (with a cookie and SAML with certificates flow), another one for apps (with an apptoapp with JWT flow).

The thing is that in order to not break the flow of the web app, I need the controller to have the [Authorize] tag + some Filters, and to use it with the App I need to check for a token with another completely different filter.

Assuming I am not able to remove the [Authorize] tag (to not break the web flow), is there a dynamic way to add or remove tags to controller depending on the incoming request?
For example: If I check in a middleware and it contains a token in the header, add the filters 2, else 1.

I don't know if the question is clear enough. Anyway, thanks for your help!
filter_api.png
Was this page helpful?