开发者

Block assemblies from changing IPrinicpal

My application loads a lot of different plugin assembli开发者_如何学Goes. Each plugin can add their own services into the IoC container and can also use all services provided by the main application.

I'm moving from a home brewn security solution to use CAS (PrincipalPermissionAttribute and an own one derived from CodeAccessSecurityAttribute).

Can I prevent the loaded assemblies from changing System.Threading.Thread.CurrentPrincipal (and in that way circumvent my security checks)?


You'll need to deny SecurityPermission\ControlPrincipal permission to the plugins. This can be done, for example, by loading them in an appdomain which denies this permission to all code that does not possess your strong name signature. See http://blogs.msdn.com/b/shawnfa/archive/2005/08/08/449050.aspx for an example of this approach.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜