c# - 设置 SSL 与使用 DLL 进行身份验证登录

标签 c# asp.net session ssl active-directory

目前我们有以下情况:

1、有一个网络应用程序,当用户需要登录网络应用程序时,用户将提供他/她的帐户用户名和密码。

AD 将使用以下代码对用户名和密码进行身份验证:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using System.DirectoryServices;
using System.DirectoryServices.AccountManagement;

namespace Access
{
  public partial class Login : System.Web.UI.Page
  {
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void Button1_Click(object sender, EventArgs e)
    {
        using (PrincipalContext pc = new PrincipalContext(ContextType.Domain, txtboxDomain.Text))
        {
            bool isValid = pc.ValidateCredentials(txtboxUsername.Text, txtboxPassword.Text);
            if (isValid == true)
            {
                lblLogin.Text = "VALID";
                Session["Person"] = txtboxUsername.Text;
                Session.Timeout = 1;
            }
            else
            {
                lblLogin.Text = "INVALID";
            }
        }
    }


  }
}

但是,同事'A'提到上面的方式一点都不安全。

她提供的理由如下:

  • IIS 上没有 SSL 设置。
  • 即使IIS没有SSL Setup,至少要用IT部门的安全DLL文件来提供认证方式。

但是,另一位同事“B”对她的回答表示怀疑,他表示,由于代码将针对 Active Directory (AD) 进行身份验证,因此它肯定是安全的,因此无需在 IIS 上设置 SSL Web 应用程序已托管。

此外,他还告诉她,IT 部门的安全 DLL 文件可能无法提供额外的安全性,因为首先,它是封闭式的,其次,他认为这只会减少对身份验证方法进行编码的需要。

那么,我可以知道我的同事 A 在多大程度上是正确的,或者我的同事 B 在多大程度上是正确的?

最佳答案

为了证明 Wireshark 是您唯一需要的工具。

只需配置一个过滤器来捕获在端口 443 上发送到您的网络服务器的数据包,然后深入分析它们。

先发布不带 HTTPS 的表单(端口 80),然后比较两者。

关于c# - 设置 SSL 与使用 DLL 进行身份验证登录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13874207/

相关文章:

c# - 单声道:无法加载文件或程序集 'System.Threading.Tasks.Dataflow'

c# - ASP.NET SqlDataSource Gridview 问题

asp.net - asp.net 中的强类型 session

asp.net - 如何在构建期间设置 appsettings.json 文件中的键值

php - iframe 中的 laravel 应用程序不断刷新 session

http - 访问容器管理的 session 监听器

c# - 根据 xaml 中的文本框禁用/启用按钮

c# - 如何将 List<IEntity> 转换为 List<Entity>?

c# - 如果 .NET 支持的 iso 代码不足以发现语言/区域怎么办

c# - 在 asp.net 中存储用户相关数据的最佳位置在哪里?