使用 basicHttpBinding 创建安全应用程序

发布于 2024-09-07 17:40:43 字数 296 浏览 0 评论 0原文

因为面对这个问题,我这些天真的很累。 我正在构建一个使用 WCF 服务的 XBAP 应用程序(WPF 浏览器应用程序)。 此应用程序要求:

  • 用户可以使用他们的用户名和密码(存​​储在我的数据库中)登录
  • 用户不需要安装任何 X509 证书(*.pfx 或 *.cert...)
  • WCF服务必须使用basicHttpBinding(以支持其他silverlight应用程序)

我已经尝试了很多方法,但它们不符合这些要求。 你有什么解决办法吗?提前致谢。

I am really really tired these day because of facing this problem.
I am building a XBAP application (WPF Browser Application) that uses WCF Service.
This app requires:

  • Users can login by using their username and password (that store in my database)
  • Users don't need to install any of X509 certificate (*.pfx or *.cert...)
  • The WCF service must use basicHttpBinding (to support an other silverlight application)

I have tried a lot of way but they are not match these requirements.
Do you have any solution? Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

再见回来 2024-09-14 17:40:43

basicHttpBinding - 顾名思义 - 它提供的功能非常基本。当涉及到安全性时,这是特别基本的。

据我所知,你无法实现你想要做的事情。 BasicHttpBinding 仅支持使用 Windows 凭据(不适合通过 Internet 使用自定义用户)或数字证书的传输安全(使用 https 协议),或通过数字证书实现的消息安全(您明确排除 - 为什么?)。

查看这篇 CodeProject 文章在 WCF BasicHttpBinding 上启用 Windows 身份验证的 8 个步骤或 Google “basicHttpBinding 安全性” - 您会找到很多文章,但可能没有真正满足您要求的解决方案 - 您只是无法使用 basicHttpBinding 做到这一点。

更新:默认情况下,在 WCF 中,您应该在每次调用时传递调用者的凭据 - 但不是作为服务方法上的参数,而是通过在服务代理生成的客户端上指定客户端凭据。像这样的东西:

 myService.ClientCredentials.UserName.UserName = "username";
 myService.ClientCredentials.UserName.Password = "p@ssw0rd";

basicHttpBinding is - as its name implies - very basic in what it offers. It's especially basic when it comes to security.

As far as I know, you cannot achieve what you're trying to do. BasicHttpBinding only supports transport security (using https protocol) with Windows credentials (not suitable over Internet with custom users) or digital certificates, or message security by means of a digital certificate (which you explicitly rule out - why??).

Check this CodeProject article 8 steps to enable windows authentication on WCF BasicHttpBinding or Google for "basicHttpBinding security" - you'll find lots of articles, but probably no real solution for your requirements - you just cannot do this with basicHttpBinding.

Update: by default in WCF, you should pass the caller's credentials with every call - but not as parameters on the service method, but instead by specifying the client credentials on the service proxy generated client-side. Something like:

 myService.ClientCredentials.UserName.UserName = "username";
 myService.ClientCredentials.UserName.Password = "p@ssw0rd";
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文