开发者

Problem with WCF Ria Services RequiresRole attribute

开发者 https://www.devze.com 2023-01-15 14:59 出处:网络
I have a User class that implemented the IUser interface and is used in the AuthenticationService of my WCF RIA app.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消