【问题标题】:Is it necessary to encrypt or hash passwords with spring security and ldap?是否有必要使用 spring security 和 ldap 加密或散列密码?
【发布时间】:2019-09-27 16:04:44
【问题描述】:

我有一个用户登录的前端。它向具有 Spring 安全性的后端发出请求,并在 LDAP 中搜索用户。

这是我使用 ajax 的前端请求的简单代码:

function login() {

$.ajax({
    url : 'http://localhost:8080/log',
    type : 'POST',
    contentType : 'application/json',
    data : JSON.stringify({
        "user" : $("#loginUser").val(),
        "password" : $("#loginPass").val()
    }),
    success : function(jqXhr, textStatus, data) {



        localStorage.setItem("user",$("#loginUser").val());
        window.open("../dashboard/home.html", "_self");

        console.log(data);
    },
    error : function(jqXhr, textStatus, errorThrown) {
        console.log(errorThrown);
    }
});

}

我需要知道是否有必要通过散列或加密来增加一些安全性,因为我以某种方式将纯密码发送到后端,以及正在获取 LDAP 信息的服务器中。

提前致谢。

【问题讨论】:

    标签: spring spring-security hash ldap


    【解决方案1】:

    如果您在 POST 请求的正文中发送用户名和密码,请使用 https(基于 TLS 的 http)。您可能需要配置您的服务器来进行设置。这样做将确保没有其他人可以破译您的请求的内容。

    当请求到达您的 Spring Web 应用程序时,用户名和密码将采用“纯文本”格式,然后您可以使用 LDAP 服务器进行身份验证。您可以使用 LDAP over TLS 与您的服务器建立安全连接。如果您使用 Spring Security,请查看 spring-ldap 文档以了解 Spring 如何抽象 LDAP 连接的某些元素的概述,并查看 Spring Security 参考以了解如何配置 Spring Security 框架以无缝地验证用户身份通过访问 LDAP 服务器。

    【讨论】:

      猜你喜欢
      • 2011-11-14
      • 1970-01-01
      • 2015-04-20
      • 1970-01-01
      • 2012-03-28
      • 2014-09-13
      • 1970-01-01
      • 2018-12-10
      • 2018-10-08
      相关资源
      最近更新 更多