向Webview控件提供域/用户凭据 [英] providing domain/user credentials to webview control

查看:101
本文介绍了向Webview控件提供域/用户凭据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道如何向WebView控件提供凭据(或者甚至更好-在特定域用户的上下文中运行Windows 8 Metro风格的应用程序/ WinRT应用程序吗?)我尝试遵循HttpClient + WebView方法此处列出(http://social.msdn.microsoft.com/Forums/en-US/winappswithcsharp/thread/05e46a0a-e913-469d-a4a5-4a805dcf158a),但它仍会提示用户输入凭据,因为在返回的内容中是安全项目的链接。

Does anyone know how to provide credentials to a WebView control (or even better - run a Windows 8 Metro style application / WinRT app in the context of a specific domain user?) I've tried following the HttpClient + WebView approach as listed here (http://social.msdn.microsoft.com/Forums/en-US/winappswithcsharp/thread/05e46a0a-e913-469d-a4a5-4a805dcf158a) but it still prompts the user for credentials, since in the returned content there are links to secured items.

我有一个NetworkCredential对象,我非常想将其应用于所进行的每个HTTP调用。

I have a NetworkCredential object, and I pretty much want to apply it to every single HTTP call that gets made.

肯定有人必须这样做吗? :)

Surely someone must have done this before? :)

推荐答案

要连接到公司网络上的站点,必须启用 privateNetworkClientServer 功能在您的 Package.appxmanifest 中。您可以在XML中执行此操作,也可以在Visual Studio中双击该文件并使用设计器(功能选项卡)。在用户界面中,它称为家庭或工作网络。

In order to connect to sites on your corporate network you must enable the privateNetworkClientServer capability in your Package.appxmanifest. You can do this in the XML or you can double-click on the file in Visual Studio and use the designer (capabilities tab). In the UI it's called "Home or Work Networking".

现在,您可以访问Intranet,可以导航到该网站,但系统会提示您提供凭据。如果希望自动提供用户域标识(企业单点登录),则还需要启用 enterpriseAuthentication 功能。在清单UI中称为企业身份验证。

Now that you have access to the intranet you can navigate to the site but you will be prompted to provide credentials. If you want the users domain identity to automatically be supplied (enterprise single sign on) you need to enable the enterpriseAuthentication capability as well. This is called "Enterprise Authentication" in the manifest UI.

从那里您应该能够使用WebView浏览到任何Intranet站点,而不必进行身份验证。如果您要在WebView之外进行操作,则应查看以下文章和示例:

From there you should be able to browse to any intranet site using a WebView and not have to authenticate. If you are looking to do things outside of the WebView, you should check out the following articles and samples:

使用WebAuthenticationBroker:

Using WebAuthenticationBroker:

http://code.msdn.microsoft.com/windowsapps/ Web-Authentication-d0485122

WebAuthenticationBroker有一个名为 UseCorporateNetwork 的选项。

WebAuthenticationBroker has an option called UseCorporateNetwork. Make sure to use that when following along in the sample above.

最后,如果要与Facebook或Flicr等其他网站进行单一登录,请参见以下示例:

Finally, if you want to do Single Sign On with other sites like Facebook or Flicr, see this sample:

http://msdn.microsoft.com/zh-CN/library/windows/apps/xaml/Hh465283

这篇关于向Webview控件提供域/用户凭据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆