improve.dk
Just another mindless drone looking for the perfect stack
posts - 220, comments - 475

November 2008 Blog Posts


Implementing imperative security declaratively using PostSharp

Written on Saturday, November 01, 2008 by Mark S. Rasmussen in Development: .NET, Sysadmin: Security

At a recent TechTalk I talked about code access security and how to perform declarative and imperative security demands & requests. There's no doubt declarative security checking is nicer than imperative checking, but not everything can be done declaratively. Say we have the following method: static void writeFile(string filePath) { File.WriteAllText("test", filePath); } We want to make sure we have permission to write to the filepath. Declaratively, we can request (SecurityAction.RequestMinimum) for an unrestricted FileIOPermission which would ensure that we had write access. But requesting unrestricted IO access is way overkill, since we only need access to select paths. I got the question,...

No comments | Write first comment