Declarative Security w/ custom principal
-
I have created a custom principal class based on IPrincipal and have exteded it for additional properties and methogs such as .UserName, .UserID to return data and IsInAnyRole to accept a list of possible roles for a user. Is there a way that I can use Declarative security with this for something like...
Public Shared Sub _ [PrincipalPermissionAttribute(SecurityAction.Demand, IsInAnyRole:="Role1,Role2,etc...")] _ PrivateInfo() 'Print secret data. Console.WriteLine(ControlChars.CrLf + "You have access to the private data!") End Sub
The isInAnyRole is not part of the PrincipalPermissionAttribute class though. Is there an easy way to write or extend it so that I can use it with extended methods from my custom principal class? Thanks in advanvce for any help...