简体   繁体   English

实现Rss源的安全性

[英]Implementing Security for Rss Feeds

A)I want to be able to support password protection of my RSS feeds through the following authentication methods: A)我希望能够通过以下身份验证方法支持我的RSS源的密码保护:

HTTP Basic Integrated Windows (NTLM/Kerberos) Digest HTTP基本集成Windows(NTLM / Kerberos)摘要

1)How can i do that in asp.net mvc 1)我怎么能在asp.net mvc中做到这一点

B) Reading over the RSS 2.0 specification, I saw nothing related to security, so I assume that security implemented for the RSS feed is handled on one end by the web server handling the HTTP request for the RSS feed, and on the other end by the client requesting access to the RSS feed. B)阅读RSS 2.0规范,我没有看到任何与安全性相关的内容,因此我假设为RSS源实现的安全性由处理RSS源的HTTP请求的Web服务器在一端处理,另一端由客户端请求访问RSS源。 The client should collect a user name and password, and put that information into the request to the server. 客户端应收集用户名和密码,并将该信息放入对服务器的请求中。 I'm curious to know how (or if) sites like UserLand, or ASP.NET Weblogs offer password protected RSS feeds, and on the other side of the fence, how are RSS aggregators like NewsGator, NewzCrawler, SharpReader, etc. handling password protected RSS feeds? 我很想知道UserLand或ASP.NET Weblogs等网站如何(或者是否)提供受密码保护的RSS提要,而另一方面,如RSSAd聚合器如NewsGator,NewzCrawler,SharpReader等处理密码受保护的RSS源?

RSS does not have any security built in. You can harness ASP.NET MVC by creating a custom ActionResult, which can provide authentication, this is with forms authentication, but you can see the idea. RSS没有内置的任何安全性。您可以通过创建自定义ActionResult来利用ASP.NET MVC,它可以提供身份验证,这与表单身份验证有关,但您可以看到这个想法。

public class RssActionResult : ActionResult
{
    public SyndicationFeed Feed { get;set; }

    public override void ExecuteResult(ControllerContext context)
    {
        if (context.HttpContext.Current.User.Identity.IsAuthenticated)
        {
            context.HttpContext.Response.ContentType = "application/rss+xml";
            Rss20FeedFormatter rssFormatter = new Rss20FeedFormatter(Feed);
            using (XmlWriter writer = XmlWriter.Create(context.HttpContext.Response.Output))
            {
                rssFormatter.WriteTo(writer);
            }
        }
        else
        {
            //Whatever, not authenticated
        }
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM