【问题标题】:mvc wcf securitymvc wcf 安全性
【发布时间】:2013-03-04 21:41:10
【问题描述】:

我有一个使用表单身份验证的 MVC 应用程序。此应用程序还托管 WCF Web 服务(模型)。 Webservice 为应用程序提供 c# 对象,当从应用程序(浏览器)外部调用时,相同的数据可用作 JSON。 除了 Web 服务没有对​​任何请求进行身份验证之外,一切都运行良好。以下是我在 web.config 中的内容:

<system.serviceModel>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
<behaviors>
  <endpointBehaviors>
    <behavior name="ServiceBehavior">
      <webHttp />
    </behavior>
  </endpointBehaviors>
</behaviors>
<bindings>
  <webHttpBinding>
    <binding name="webHttpBindingWithJson" crossDomainScriptAccessEnabled="true" />
  </webHttpBinding>
</bindings>
<services>
  <service name="Services.MyService">
    <endpoint address="http://localhost:1234/MyService.svc/" binding="webHttpBinding"
              bindingConfiguration="webHttpBindingWithJson"
              contract="Services.IService"
              behaviorConfiguration="ServiceBehavior"/>
  </service>
</services>

我想验证 Web 服务请求:

  • 应自动验证来自应用程序内部的请求
  • 从应用程序外部调用 Web 服务时,会要求用户进行身份验证。

任何帮助将不胜感激。

/D

【问题讨论】:

    标签: wcf model-view-controller authentication wcf-security


    【解决方案1】:

    听起来您需要一个内部端点来提供 wsdl 用于绑定到网站(使用网站正在运行的 ASP.NET 身份进行身份验证)和一个单独的外部绑定,用于使用 OAuth 之类的 JSON 请求认证。

    无论哪种方式,您都会看到两种不同的身份验证机制。

    【讨论】:

      猜你喜欢
      • 2011-10-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-02-13
      • 1970-01-01
      相关资源
      最近更新 更多