Silverlight 和 SSL 客户端证书 [英] Silverlight and SSL Client Certificates

查看:49
本文介绍了Silverlight 和 SSL 客户端证书的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

谁能为我指明正确的方向,如何将 SSL 客户端证书与 Silverlight 结合使用来访问宁静的 Web 服务?

Can anyone point me in the right direction of how I can use SSL client-side certificates with Silverlight to access a restful web service?

我似乎找不到任何关于如何处理它们,甚至它们是否受支持的信息.

I can't seem to find anything on how to handle them, or even whether they are supported.

干杯.

推荐答案

Slipjig 提到了这个:

Slipjig mentioned this:

如果您愿意忍受其他限制(缺乏对所有 HTTP 动词的支持、响应状态代码的强制等),浏览器堆栈就会这样做,而且几乎是自动的."

"The browser stack does, and pretty much automatically, if you're willing to live with its other limitations (lack of support for all HTTP verbs, coercion of response status codes, etc.)."

如果这对您来说是可以接受的,请查看 Microsoft 如何在他们的某些 API 中使用自定义 X-HTTP-Method 标头处理此问题,例如他们如何处理 WCF 和 OData:

If that is acceptable to you, look at how Microsoft themselves deal with this in some of their APIs using the custom X-HTTP-Method header, like how they do it for WCF and OData:

http://www.odata.org/developers/protocols/operations

在 MSDN 中,Microsoft 还提到了将 REST 与 SharePoint 2010 的基于 WCF 的 REST API 结合使用的情况:

In MSDN, Microsoft also mentions this about using REST in conjunction with SharePoint 2010's WCF based REST API:

msdn.microsoft.com/en-us/library/ff798339.aspx

msdn.microsoft.com/en-us/library/ff798339.aspx

实际上,除了 GET 和 POST 之外,许多防火墙和其他网络中介都会阻止 HTTP 动词.为了解决这个问题,WCF 数据服务(和 OData 标准)支持一种称为动词隧道"的技术.在这种技术中、PUT、DELETE 和 MERGE 请求作为 POST 请求提交,并且 X-HTTP-Method 标头指定接收者应应用于请求的实际动词.有关更多信息,请参阅 MSDN 和 OData 上的 X-HTTP-Method:OData 网站上的操作(通过 POST 的方法隧道部分)."

"In practice, many firewalls and other network intermediaries block HTTP verbs other than GET and POST. To work around this issue, WCF Data Services (and the OData standard) support a technique known as "verb tunneling." In this technique, PUT, DELETE, and MERGE requests are submitted as a POST request, and an X-HTTP-Method header specifies the actual verb that the recipient should apply to the request. For more information, see X-HTTP-Method on MSDN and OData: Operations (the Method Tunneling through POST section) on the OData Web site."

Don Box 对此也说了一些话,但特别是关于 GData:

Don Box's also had some words about this, but regarding GData specifically:

www.pluralsight-training.net/community/blogs/dbox/archive/2007/01/16/45725.aspx

www.pluralsight-training.net/community/blogs/dbox/archive/2007/01/16/45725.aspx

如果我正在构建一个 GData 客户端,我真的想知道为什么我要费心使用 DELETE 和 PUT 方法,因为 X-HTTP-Method-Override 将在更多案例/部署中工作."

"If I were building a GData client, I honestly wonder why I'd bother using DELETE and PUT methods at all given that X-HTTP-Method-Override is going to work in more cases/deployments."

有一篇关于 Silverlight 和 Java 互操作的文章也通过提供相同的建议解决了 Silverlight 的这一限制:

There's an article about Silverlight and Java interop which also addresses this limitation of Silverlight by giving the same advice:

www.infoq.com/articles/silverlight-java-interop

www.infoq.com/articles/silverlight-java-interop

Silverlight 仅支持 GET 和 POST HTTP 方法.一些防火墙限制使用 PUT 和 DELETE HTTP 方法.

"Silverlight supports only the GET and POST HTTP methods. Some firewalls restrict the use of PUT and DELETE HTTP methods.

需要指出的是,仅使用 GET 和 POST HTTP 方法就可以创建真正的 RESTful 服务(符合上面列出的所有 REST 原则),换句话说,REST 架构不需要特定的 HTTP 映射.Google 的 GData X-Http-Method-Override 标头就是这种方法的一个示例.

It is important to point out that true RESTful service can be created (conforming to all the REST principles listed above) only using the GET and POST HTTP methods, in other words the REST architecture does not require a specific mapping to HTTP. Google’s GData X-Http-Method-Override header is an example of this approach.

如果 Web 服务在 POST 上解释 X-HTTP-Method-Override 标头,则可以在标头中设置以下 HTTP 方法覆盖以完成 PUT 和 DELETE 操作:

The following HTTP methods overrides may be set in the header to accomplish the PUT and DELETE actions if the web services interpret the X-HTTP-Method-Override header on a POST:

* X-HTTP-Method-Override: PUT
* X-HTTP-Method-Override: DELETE"

希望这有帮助-乔希

这篇关于Silverlight 和 SSL 客户端证书的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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