This is a C# WPF application for a desktop. I've created a custom attribute class but in debug it never goes in there. Do I need to add something else to this class?
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true, Inherited = true)]
public class Authentication : Attribute, IPrincipal
{
public Authentication(string id)
{
throw new NotImplementedException();
}
public IIdentity Identity { get; private set; }
public bool IsInRole(string role)
{
throw new NotImplementedException();
}
}
And the method is:
[Authentication(SecurityConstants.DataEntrySupervisor)]
[Authentication(SecurityConstants.DataVerificationClerk)]
public void Submit(EventObject eventObject)
{//////////}
An attribute is not called by the runtime in any way. It probably does not even get instanciated until you poke around with reflection.
You can look at SecurityAttribute if you want to do code security with attributes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With