【发布时间】:2015-11-15 14:59:12
【问题描述】:
我有一个远程 WCF 服务,托管在 IIS 上。然后我有一个托管在 Azure 网站上的 ASP.NET MVC 网站。
该网站使用 Azure Active Directory 对用户进行身份验证,并且运行良好。但是,WCF 服务需要正确的 Windows(基于域)凭据才能返回结果。
当我在我的 ASP.NET MVC 应用程序中实例化服务时,我正在使用:
SomeService.ServiceClient client = new ServiceClient ("SOAP");
client.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation;
这是由Web.config 文件支持的:
<basicHttpBinding>
<binding name="SOAP" allowCookies="true" maxReceivedMessageSize="20000000"
maxBufferSize="20000000"
maxBufferPoolSize="20000000">
<readerQuotas maxDepth="32"
maxArrayLength="200000000"
maxStringContentLength="200000000"/>
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Windows" proxyCredentialType="None" realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
当我在本地运行 时,它运行良好 - 我正在从本地 AppPool 获取凭据,这些凭据可用于访问 WCF 服务。但是,一旦我将网站部署到 Azure,上述情况就会中断,因为服务显然不知道我在本地拥有的凭据。
问题:
有没有办法让我通过浏览器将 Windows 凭据传递给 WCF 服务,而不会破坏 AAD 身份验证堆栈,因为我只需要那些用于 WCF 连接而不需要其他任何东西?我完全可以显示系统提示输入凭据。
【问题讨论】:
-
你有没有想过这个问题?我正在尝试做同样的事情,但我想使用 .NET 服务客户端从 javascript 而不是 C# 调用所述 Web 服务,就像你正在做的那样。
标签: asp.net asp.net-mvc wcf azure azure-active-directory