Groups | Blog | Home
all groups > dotnet security > june 2005 >

dotnet security : IsInRole vs Demand


Martin.McDonald NO[at]SPAM us.logicalis.com
6/22/2005 12:24:28 PM
Hello, I'm trying to determine the difference between using
IPrincipal.IsInRole and PrincipalPermission.Demand. About the only
thing I can think of is that "Demand" allows a bit more flexibility
because it's constructor allows name/role, name/null, null/role. Plus,
it allows for the Union of more than one permission.
Are those the only differences, or am I missing more? Thanks for your
input.
Dominick Baier [DevelopMentor]
6/22/2005 12:40:53 PM
Hello Martin.McDonald@us.logicalis.com,

internally PrincipalPermission calls IsInRole on Thread.CurrentPrincipal
and if false is returned, a SecurityException is thrown.

So it is really just a matter of taste.

---------------------------------------
Dominick Baier - DevelopMentor
http://www.leastprivilege.com

[quoted text, click to view]


AddThis Social Bookmark Button