Custom CodeAccessSecurity implementing Beta expriration
-
I'd like a "BetaExpiration" attribute (DECLARITIVE security) on my classes that is enforced automatically when the assembly containing the classes is used. A security exception should be thrown if the classes are being used outside beta period. [AllowedUse(From = "2003-1-30")] public class x { public x() {} } CodeAccessSecurity permission is the way to do it and I've already got an test implementation. The major problem is that my custom CodeAccessSecurity derived permission assembly should be registered on the user's machine using CasPol etc for the .Net security system to find and use it. This is not desirable. The app should just be installed and my custom codesecurity access should be enforced... Another way is implement another custom permissing, implement IPermission, ISecurityEncodable. Unfortunately, the declarative notation is never instantiated, unless I do it myself in code; the imparative method is working fine, but I'd like to use attributes for this! public x() { AllowedUse2 au = new AllowedUse2(); au.From = "2003-1-30"; au.Demand(); } Does anyone have a bright idea how to enforce custom CodeAccessSecurity using declarative notation without requiring .Net registration of the permission assembly? Victor
-
I'd like a "BetaExpiration" attribute (DECLARITIVE security) on my classes that is enforced automatically when the assembly containing the classes is used. A security exception should be thrown if the classes are being used outside beta period. [AllowedUse(From = "2003-1-30")] public class x { public x() {} } CodeAccessSecurity permission is the way to do it and I've already got an test implementation. The major problem is that my custom CodeAccessSecurity derived permission assembly should be registered on the user's machine using CasPol etc for the .Net security system to find and use it. This is not desirable. The app should just be installed and my custom codesecurity access should be enforced... Another way is implement another custom permissing, implement IPermission, ISecurityEncodable. Unfortunately, the declarative notation is never instantiated, unless I do it myself in code; the imparative method is working fine, but I'd like to use attributes for this! public x() { AllowedUse2 au = new AllowedUse2(); au.From = "2003-1-30"; au.Demand(); } Does anyone have a bright idea how to enforce custom CodeAccessSecurity using declarative notation without requiring .Net registration of the permission assembly? Victor
Never mind, I thought of a solution. VictorV