A
Andrew Jocelyn
Hi
I want to use the PrincipalPermissionAttribute to protect classes and
methods in my business logic layer. I have custom IPrinciple and IIdentity
classes and I'm not sure what I need to do to make thenm compatible with the
PrincipalPermissionAttribute.
public class SitePrincipal : System.Security.Principal.IPrincipal
{
public SitePrincipal(int accountID)
{
_identity = new SiteIdentity(accountID);
_role = "Special";
}
}
At the moment the above class is called in a web page OnPreInit event:
Context.User = new SitePrincipal(1773);
The class is authenticated.
[PrincipalPermission(SecurityAction.Demand, Authenticated = true, Role =
"Special")]
public class MyClassBLL
{}
What do I need to do to get my custom IPrincipal to work with the
PrincipalPermissionAttribute class? At the moment the test fails the
security check. Is there some test code I could use to debug with? I'm not
sure of the best way when working with attributes.
Thanks
Andrew
I want to use the PrincipalPermissionAttribute to protect classes and
methods in my business logic layer. I have custom IPrinciple and IIdentity
classes and I'm not sure what I need to do to make thenm compatible with the
PrincipalPermissionAttribute.
public class SitePrincipal : System.Security.Principal.IPrincipal
{
public SitePrincipal(int accountID)
{
_identity = new SiteIdentity(accountID);
_role = "Special";
}
}
At the moment the above class is called in a web page OnPreInit event:
Context.User = new SitePrincipal(1773);
The class is authenticated.
[PrincipalPermission(SecurityAction.Demand, Authenticated = true, Role =
"Special")]
public class MyClassBLL
{}
What do I need to do to get my custom IPrincipal to work with the
PrincipalPermissionAttribute class? At the moment the test fails the
security check. Is there some test code I could use to debug with? I'm not
sure of the best way when working with attributes.
Thanks
Andrew