【问题标题】:Basic Authentication with WCF Web API Preview 6使用 WCF Web API 预览版 6 进行基本身份验证
【发布时间】:2012-08-24 17:23:13
【问题描述】:

我正在尝试将新的 WCF Web API Preview 6 与基本身份验证一起使用。但真的不知道从哪里开始。

zanewill 显然也有同样的问题:
https://stackoverflow.com/questions/8304367/how-to-use-basic-authentication-with-wcf-web-api 但问题不是重复。我正在将它与 mvc 一起使用,但并不真正了解如何
Wcf Basic authentication
应该申请吗?

我已经试过了:
http://cacheandquery.com/blog/2011/03/customizing-asp-net-mvc-basic-authentication/
但不能让它工作。 不应该有MS的官方解决方案吗?

我必须注意,我们正在使用我们的自定义会员提供程序,并且我基本上只是想将 API 令牌传递给服务。所以无法使用内置的 Windows Basic Authentification。

【问题讨论】:

    标签: wcf asp.net-mvc-3 wcf-security


    【解决方案1】:

    其实我自己想出了一个办法。我已经构建了我的自定义 HttpOperationHandler 并将它与一个属性结合起来,所以我得到了与 MVC AuthorizeAttribute 类似的功能。

    您可以在这里查看解决方案:
    http://remy.supertext.ch/2012/02/basic-authentication-with-wcf-web-api-preview-6/

    【讨论】:

    【解决方案2】:

    我认为推荐的方法是实现自定义消息处理程序。有关使用 ASP.NET Web API RTM 的示例,请参阅我的博客文章:

    http://www.piotrwalat.net/basic-http-authentication-in-asp-net-web-api-using-message-handlers/

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-09-29
      • 2016-06-17
      • 1970-01-01
      • 1970-01-01
      • 2012-01-03
      • 2015-08-12
      相关资源
      最近更新 更多