Can an Aspect be added to a custom derived attribute class such as "public class MyAttribute : AuthorizeAttribute"? #261
-
Can an Aspect be added to a custom derived attribute class such as "public class MyAttribute : AuthorizeAttribute"?
If yes, could this be a potential way to modify the behavior of MyAttribute class to dynamically provide Policy/Role data overriding the compile time parameter values requirement of the AuthorizeAttribute? I'll explore the validity of this concept if it seems plausible. I'm just exploring concepts/ways to come up with a solution to dynamic authorization of my users without creating code blocks in each and every Blazor page. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Yes, this is possible. The modifications to the attribute will be visible at run time through reflection. Another question is whether this is desirable. Unless you have many of these attributes (which I find weird), using an aspect on an attribute could be more complex than a pure object-oriented solution. |
Beta Was this translation helpful? Give feedback.
Yes, this is possible. The modifications to the attribute will be visible at run time through reflection.
Another question is whether this is desirable. Unless you have many of these attributes (which I find weird), using an aspect on an attribute could be more complex than a pure object-oriented solution.