[英]Java ActiveDirectory LDAP - Authenticate user with password hash
I want to authenticate a active directory user with a on javascript client side hashed password. 我想使用javascript客户端哈希密码对活动目录用户进行身份验证。 Is that possible? 那可能吗? Currently I'm transfering the password in plain text to the server via a https connection. 目前,我正在通过https连接将纯文本密码传输到服务器。
This is my java side code to check the provided password: 这是我的Java辅助代码,用于检查提供的密码:
public DirContext getDirContext( String dn, String password ) throws NamingException {
Hashtable<String, String> ldapEnv = new Hashtable<>();
ldapEnv.put( Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory" );
ldapEnv.put( Context.PROVIDER_URL, this.providerUrl );
ldapEnv.put( Context.SECURITY_AUTHENTICATION, "simple" );
ldapEnv.put( Context.SECURITY_PRINCIPAL, dn );
ldapEnv.put( Context.SECURITY_CREDENTIALS, password );
return new InitialDirContext( ldapEnv );
}
This will work, you need to close connection before returning context
: 这将起作用,您需要在返回context
之前关闭连接:
DirContext context = new InitialDirContext(ldapEnv);
if(context != null)
context.close();
return context;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.