I am using VS2010 to learn about Silverlight4 Business Application with the MVVM design pattern.
Trying to figure out how to declaratively secure a SL4 view (either a Page or UserControl or ChildWindow).
I recall in an ASP.NET 2.0 web application, I could have put the PrincipalPermission attribute on my webpage.
Example:
using System.Security.Permissions;
[PrincipalPermission(SecurityAction.Demand, Authenticated=true, Role="Manager")]
public partial class Default : System.Web.UI.Page
{//blab blab
}
Seem cannot do that in the "SL4" project as it would not even let me set a reference to the System.Security.
My google search keeps returning results about securing the WCF method calls, which is fine as another layer of securi开发者_如何转开发ty; but I would also like to do declarative security on the SL view itself too.
Anyone has any ideas? (remember I am new to SL development)
Thanks Sheir
I think you either want
[PrincipalPermission(SecurityAction.Demand, Authenticated=true]
or
[PrincipalPermission(SecurityAction.Demand, Role="Manager")]
the latter means you are logged in / and your IPrinciple is associated with a role of manager...
the first one means you are just logged in - ergo a valid user.
精彩评论