【问题标题】:Digest authentication in ASP.NET Core / KestrelASP.NET Core / Kestrel 中的摘要式身份验证
【发布时间】:2017-03-02 18:17:18
【问题描述】:

是否可以在 ASP.NET Core / Kestrel 中使用digest authentication?如果是,我该如何启用和使用它?

我知道basic authentication 没有也不会实现,因为it's considered insecure and slow,但我根本找不到任何关于摘要的信息。

我不想使用 IIS 的身份验证,因为我不想绑定到 Windows 帐户,我想使用自定义凭据验证逻辑。

【问题讨论】:

    标签: asp.net-core digest-authentication kestrel-http-server


    【解决方案1】:

    Core 目前唯一可用的摘要式身份验证实现是 IIS 中与集成 Windows 身份验证相关联的那个。

    【讨论】:

      【解决方案2】:

      如果有人正在寻找答案。这段代码对我有用:

      using System.ServiceModel;
      
      var binding = new BasicHttpBinding();
      binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Digest;
      binding.TextEncoding = Encoding.UTF8;
      binding.TransferMode = TransferMode.Buffered;
      binding.AllowCookies = false;
      binding.Security.Mode = BasicHttpSecurityMode.TransportCredentialOnly;
      
      var endpoint = new EndpointAddress(new Uri("http://website.domain/WebService.svc"));
      var client = new MessageServiceClient(binding, endpoint);
      client.ClientCredentials.HttpDigest.ClientCredential.UserName = "username";
      client.ClientCredentials.HttpDigest.ClientCredential.Password = "password";
      
      var response = client.CallMethod();
      

      【讨论】:

      • ASP.NET Core中如何使用?
      【解决方案3】:

      关于 Kestrel、WebListener 服务器和身份验证的一些事情

      以及如何允许匿名用户使用 WebListener 的示例:

      builder.UseWebListener(options =>
      {    
           options.Listener.AuthenticationManager.AuthenticationSchemes = AuthenticationSchemes.AllowAnonymous;
      });
      

      【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-07-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多