CredentialCache.Add 方法中的 authType 参数

发布于 2024-09-08 08:58:12 字数 251 浏览 2 评论 0原文

CredentialCache.Add 方法中的 authType 是什么? http://msdn.microsoft.com/en-us/library/czdw7s9e。 ASPX 我不明白根据我传递给此 Add 方法的 uRi 应该传递什么。而我的 uRi 实际上是一个 asmx 页面地址

what is the authType in CredentialCache.Add Method ?
http://msdn.microsoft.com/en-us/library/czdw7s9e.aspx
I do not understand what should I pass to it based on the uRi that I am passing to this Add method. and my uRi is actually an asmx page address

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

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

发布评论

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

评论(3

攒眉千度 2024-09-15 08:58:12

主要有两种 HTTP 身份验证方案:

  • BASIC:用户名和密码以明文形式添加到HTTP 请求标头
  • DIGEST:服务器用随机数向客户端发起挑战,客户端用哈希值进行响应服务器可以验证的随机数和密码的(摘要

authType 参数是将凭据添加到缓存的 HTTP 身份验证方案。发出请求时,服务器将首先响应 403 并指定支持的身份验证方案,以及领域和随机数(如果需要)。如果请求的身份验证类型在缓存中(基本或摘要),则请求将使用凭据缓存来响应质询。第一次调用后的后续调用可能会预先发送身份验证信息,如果 预验证已设置。

There are two main HTTP authentication schemes:

  • BASIC: user name and password are added in clear to the HTTP request headers
  • DIGEST: the server chalenges the client with a nonce and the client responds with a hash (digest) of the nonce and the password, which the server can verify

The authType parameters is the HTTP authentication scheme for which the credentials are added to the cache. When making a request, the server will first respond with a 403 and specify an authentication schem supported, along with the realm and the nonce (if required). The request will then use the credentials cache to respond to the chalenge, if the requested authentication type is in the cache (basic or digest). Subsequent calls after the first call may pre-send the authentication info, if PreAuthenticate is set.

凡间太子 2024-09-15 08:58:12

我查看了 CredentialCache.Add() 方法的其他重载:

CredentialCache.Add(String host, Int32 port, String authenticationType, NetworkCredential credential)

可以在此处找到定义:
https://msdn.microsoft.com/en -us/library/59x2s2s6(v=vs.110).aspx
在这里,他们将字符串称为“authenticationType”(而不是“authType”)并指出:

authType 支持的值为“NTLM”、“Digest”、“Kerberos”、
和“谈判”。

我觉得这很令人困惑,因为“authType”和“authenticationType”似乎可以互换使用。

当我在问题中引用的方法重载中使用“NTLM”和“Negotiate”作为“authType”时,它对我的​​ URL 有效:

CredentialCache.Add(Uri uriPrefix, String authType, NetworkCredential cred)

I looked at the other Overload of the CredentialCache.Add() Method:

CredentialCache.Add(String host, Int32 port, String authenticationType, NetworkCredential credential)

The definition may be found here:
https://msdn.microsoft.com/en-us/library/59x2s2s6(v=vs.110).aspx
Here they call the string "authenticationType" (instead of "authType") and states:

The supported values for authType are "NTLM", "Digest", "Kerberos",
and "Negotiate".

I find this confusing because "authType " and "authenticationType" appear to be used interchangeably.

It worked for my URL when I used "NTLM" and "Negotiate" for "authType" in the Method Overload you reference in your Question:

CredentialCache.Add(Uri uriPrefix, String authType, NetworkCredential cred)
快乐很简单 2024-09-15 08:58:12

authType 似乎指的是如何通过 http Web 请求发送您提供的凭据(用户名和密码)。基本大致意味着未加密,而摘要意味着您随请求一起发送哈希值以对其进行身份验证。请注意,此身份验证类型由服务器决定,您无法选择遵循哪一种身份验证类型。
请参阅基本身份验证摘要式身份验证

The authType seems to refer to how the credential(username and password) you provide is sent with a http web request. Basic roughly means unencrypted, and digest means that you send a hash along with the request to authenticate it. Note that this authentication type is decided by the server adn you dont have a choice as to which one to follow.
See Basic Authentication and Digest Authentication

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