WCF Ria 服务 RequiresRole 属性的问题 [英] Problem with WCF Ria Services RequiresRole attribute

查看:48
本文介绍了WCF Ria 服务 RequiresRole 属性的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 User 类,它实现了 IUser 接口并在我的 WCF RIA 应用程序的 AuthenticationService 中使用.

I have a User class that implemented the IUser interface and is used in the AuthenticationService of my WCF RIA app.

每当我将 RequiresRole 属性应用到我的操作之一时,即使客户端的 WebContext.User.IsInRole("Managers") 返回 true,也会出现 Access to the operation is denied 错误.

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?

谢谢.

推荐答案

WebContext.User.IsInRole 返回 true 的原因是因为 IUser 有一个属性 Roles.

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.

这篇关于WCF Ria 服务 RequiresRole 属性的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆