ASP.NET Web 服务安全

发布于 2024-07-28 23:09:16 字数 344 浏览 1 评论 0原文

我过去构建过 ASP.NET Web 服务,这些服务要么被公开使用,要么使用 Windows 身份验证。 我现在需要构建一个使用 SOAP 1.1 协议的 Web 服务,并且需要使用调用者的用户名和密码来保护它的安全。

对于一两个人来说,为 WCP 设置基础设施似乎有些过分了网页服务。 还有其他建议吗? 我也在考虑使用 ASP.NET 4.0 Beta,如果有人对此场景进行过探索,那么了解您的意见将会很有帮助。

预先感谢您的建议。

I've built ASP.NET Web Services in the past that either were publicly consumed, or used Windows Authentication. I now need to build a Web Service that uses the SOAP 1.1 protocol and it needs to be secured with a username and password from the caller.

It seems setting up the infrastructure for WCP is overkill for one or two Web Services. Any other suggestions? I was also thinking of using ASP.NET 4.0 Beta, if anyone has explored that for this scenario, it would be helpful to know your opinion.

Thanks in advance for your suggestions.

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

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

发布评论

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

评论(3

放血 2024-08-04 23:09:16

简单的方法是创建一个特殊的标头,其中包含每次调用的身份验证信息,并以这种方式对用户进行身份验证/授权

以下是一些示例代码:
http://aspalliance.com/805_Soap_Headers_Authentication_in_Web_Services

请注意,通过这种方式,您将发送明文用户名和密码,以便您可以想要使用 ssl 或使用某种摘要身份验证

The simple way is to create a special header that carries the auth info for every call and authenticate/authorize the user that way

Here's some sample code:
http://aspalliance.com/805_Soap_Headers_Authentication_in_Web_Services

Note that in this way you are sending clear text username and password so you would want to use ssl or use some kind of digest authentication

命比纸薄 2024-08-04 23:09:16

有不同的方法可以做到这一点。 可以允许访问一组特定的 IP。 如果 IP 与列表之一不匹配,那么您可以轻松地在方法级别拒绝调用。

否则,您可以创建另一个返回令牌的方法,然后使所有相关方法期望返回该令牌,以便处理请求。

There are different ways of doing this. One could be enabling access to a specific sets of IPs. If the IP doesn't match one of the lists then you could easy reject the call at method's level.

Otherwise, you could create another method that would return a token and then make all the relevant methods to expect that token in return in order to process the request.

-小熊_ 2024-08-04 23:09:16

使用SSL。 强制所有使用您的 Web 服务的人都使用 https。

        //Check for Secure Channel: HTTPS
        if (!Context.Request.IsSecureConnection) 
            return "The HTTP Connection must use Secure Sockets (HTTPS)";

Use SSL. Force everyone who consumes your webservice to use https.

        //Check for Secure Channel: HTTPS
        if (!Context.Request.IsSecureConnection) 
            return "The HTTP Connection must use Secure Sockets (HTTPS)";
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文