WCF Ria 服务 RequiresRole 属性问题

发布于 2024-09-18 18:03:44 字数 223 浏览 2 评论 0原文

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

每当我将 RequiresRole 属性应用于我的操作之一时,即使客户端上的 WebContext.User.IsInRole("Managers") 返回 true,我也会收到访问操作被拒绝的错误。

有谁知道为什么我会收到此错误?

谢谢。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

压抑⊿情绪 2024-09-25 18:03:44

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文