Problem with WCF Ria Services RequiresRole attribute

对着背影说爱祢 提交于 2019-12-24 21:39:16

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/3694277/problem-with-wcf-ria-services-requiresrole-attribute

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!