仅使用角色属性进行站点地图安全调整,而不是在其他地方允许/拒绝规则

发布于 2024-07-24 17:00:42 字数 247 浏览 6 评论 0原文

我知道标签有“roles”属性来弥补没有“url”属性的节点,可以通过其他方式解决。 不过,我对这些其他方式不感兴趣,我想在站点地图文件中设置所有权限。 如何做到这一点?

我使用自定义 RoleProvider、自定义 MembershipProvider 和默认 XmlSiteMapProvider。 我还有一个安全 IHttpModule 来防止人们使用直接 URL 到达那里。 我对不同的方法持开放态度。

提前致谢!

I am aware that the tag has the "roles" attribute to make up for the nodes that don't have the "url" attribute, which can be resolved in other ways. I'm not interested in these other ways, though, I'd like to have all my permissions set in my sitemap file. How to accomplish this?

I'm using custom RoleProvider, custom MembershipProvider, and the default XmlSiteMapProvider. I also have a security IHttpModule to prevent people from getting there using a direct URL. I'm open to different approaches.

Thanks in advance!

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

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

发布评论

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

评论(2

泡沫很甜 2024-07-31 17:00:42

您可以实现自己的 XmlSiteMapProvider 并重写 IsAccessibleToUser 方法。

public override bool IsAccessibleToUser(HttpContext context, SiteMapNode node)
{
     return <condition in which access is allowed>
}

You can implement your own XmlSiteMapProvider and override the IsAccessibleToUser method.

public override bool IsAccessibleToUser(HttpContext context, SiteMapNode node)
{
     return <condition in which access is allowed>
}
温柔戏命师 2024-07-31 17:00:42

最后,我通过从 XmlSiteMapProvider 派生来实现了自己的安全调整。 这很简单。

public override SiteMapNodeCollection GetChildNodes(SiteMapNode node)
{
    return CustomSecurityTrim(base.GetChildNodes(node));
}

In the end I implemented my own security trimming by deriving from XmlSiteMapProvider. It was simple enough.

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