[Mono-list] Is PrincipalPermissionAttribute working?
Sébastien Pouliot
spouliot@videotron.ca
Mon, 17 May 2004 08:06:14 -0400
Hi,
The PrincipalPermission class is implemented but Mono doesn't (and won't)
support security attributes in 1.0.
See bugzilla entry #52693 for more details.
Sebastien Pouliot
http://pages.infinit.net/ctech/poupou.html
-----Original Message-----
From: mono-list-admin@lists.ximian.com
[mailto:mono-list-admin@lists.ximian.com]On Behalf Of DI Mag. Rainer
Burgstaller
Sent: 17 mai 2004 02:57
To: mono-list@lists.ximian.com
Subject: [Mono-list] Is PrincipalPermissionAttribute working?
Hi
It seems that the PrincipalPermissionAttribute is not working as expected
(at least not as I expect it :)
I checked the class status and it says 100% so I guess this means that it
should work.
I got the following code which works just nice under MS.NET.
<snip>
[PrincipalPermissionAttribute(SecurityAction.Demand, Role="root")]
public void UpdateMember( Member aMember )
{
// do something secret here :)
}
</snip>
When Thread.CurrentPrincipal.IsInRole("root") is false then under windows
this raises a SecurityException (which I think is correct). However, under
mono-0.91 it runs through without any problem (i.e. does not generate the
exception). I verified this by modding the code above to
<snip>
[PrincipalPermissionAttribute(SecurityAction.Demand, Role="root")]
public void UpdateMember( Member aMember )
{
IPrincipal princ = System.Threading.Thread.CurrentPrincipal;
bool adminRole = princ.IsInRole("root");
if ( !adminRole )
throw new Exception("You dont belong to the admins. Go
away");
// do something very secret here
}
</snip>
The modified code raises now the exception.
So here are the two options
a) I dont understand how to use PrincipalPermissionAttribute (which could
easily be true)
b) the mono implementation does not work as expected.
Can anybody help me?
_______________________________________________
Mono-list maillist - Mono-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list