PrincipalPermissionAttribute
From: Dave Sousa (XAYZBQMTRZSN_at_spammotel.com)
Date: 05/18/03
- Previous message: Ramesh.N: "Com Registartion"
- Next in thread: Joe Kaplan: "Re: PrincipalPermissionAttribute"
- Reply: Joe Kaplan: "Re: PrincipalPermissionAttribute"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Sat, 17 May 2003 19:56:55 -0700
I am running XP Pro with Framework 1.0. I have decorated
a Windows Form class with the following attribute:
[PrincipalPermissionAttribute(
SecurityAction.Demand,
Role=@"BUILTIN\Administrators")]
This always fails with a security exception. I am in the
Administrators group. Setting Authenticated=false in the
attribute passes the security check.
I then add the following code to the class constructor,
AppDomain.CurrentDomain.SetPrincipalPolicy(
PrincipalPolicy.WindowsPrincipal);
and remove the PrincipalPermission attribute from the
class definition.
When I then add the PrincipalPermission attribute to a
button onclick event, everything is authenticated as
expected.
I have seen many examples where the class definition is
decorated with the PrincipalPermission attribute, and
nobody seems to have a problem.
My question is if the default principal is
UnauthenticatedPrincipal, how can the class definition
ever be decorated with an attribute that needs a
WindowsPrincipal to check the role?
Thanks,
Dave
- Previous message: Ramesh.N: "Com Registartion"
- Next in thread: Joe Kaplan: "Re: PrincipalPermissionAttribute"
- Reply: Joe Kaplan: "Re: PrincipalPermissionAttribute"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]