Problem with WCF Ria Services RequiresRole attribute
I have a User class that implemented the IUser interface and is used in the AuthenticationService of my WCF RIA app.
Whenever I apply the RequiresRole attribute to one of my operations I get Access to the operation is denied error even though WebContext.User.IsInRole("开发者_开发知识库Managers") on the client side returns true.
Does anyone know why I get this error?
Thanks.
The reason WebContext.User.IsInRole
returns true because the IUser
has a property Roles
.
This property is set with the user's roles by the server at authentication/user-load time.
The result is that while the client has no access or knowledge on the persistent storage / server entities etc. of the roles in the server, it still has the primitive info (role names) that was rather provided to him by the server.
精彩评论