Simple:身份验证类型为Simple认证。 SASL:身份验证类型为简单认证与安全层(Simple Authentication and Security Layer)。 绑定DN 客户端发起连接请求与LDAP服务器建立会话,这一过程被称为绑定。当LDAP服务器不允许匿名访问时,需要指定绑定DN,该绑定DN用于查询目录服务器,必须具备管理员权限。
env.put(Context.PROVIDER_URL, CON_URL); env.put(Context.SECURITY_AUTHENTICATION, SECURITY_AUTHENTICATION_SIMPLE); env.put(TIMEOUT, TIMEOUT_VALUE);// 连接超时设置为2秒 //env.put(Context.SECURITY_PRINCIPAL, EMAIL_SUBFIX + username); env.put(Context.SECURITY_PRINCIPAL, username); env.put(Context...
Myers, J., "Simple Authentication and Security Layer (SASL)", RFC 2222, October 1997. Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, March 1997. Leach, P. and C. Newman, "Using Digest Authentication as a SASL Mechanism", RFC 2831, May ...
如果MongoDB 服务器目前强制执行身份验证,则必须以具有角色管理权限(如userAdmin或userAdminAnyDatabase提供的权限)的用户身份验证admin数据库。为 MongoDB 服务器配置的身份验证机制纳入适当的--authenticationMechanism。 mongosh --host <hostname> --port <port> --username <user> --password <pass> --authentica...
“none”: use no authentication (anonymous). “simple”: use weak authentication (password in clear text). sasl_mech: use strong authentication with SASL (Simple Authentication and Security Layer). 参考:http://www.codejava.net/coding/connecting-to-ldap-server-using-jndi-in-java ...
To avoid exposing the password in this way, you can use the simple authentication mechanism within an encrypted channel (such as SSL), provided that this is supported by the LDAP server. Both the LDAP v2 and v3 support simple authentication. To use the simple authentication mechanism, you ...
(Context.PROVIDER_URL,LDAP_URL);env.put(Context.SECURITY_AUTHENTICATION,"simple");env.put(Context.SECURITY_PRINCIPAL,"uid="+username+","+LDAP_BASE_DN);env.put(Context.SECURITY_CREDENTIALS,password);try{DirContextctx=newInitialDirContext(env);returntrue;}catch(AuthenticationExceptione){returnfalse;...
env.put(Context.SECURITY_AUTHENTICATION, "simple"); // 使用简单认证 return env; } } 在这个例子中,我们首先设置了LDAP环境,然后尝试使用给定的用户名和密码进行身份验证。如果身份验证成功,InitialDirContext将不会抛出异常,否则将抛出NamingException。
Context.SECURITY_AUTHENTICATION ("java.naming.security.authentication"): 指定要使用的认证机制。对于 JDK 中的 LDAP 服务提供者,这可以是以下字符串之一:"none", "simple", sasl_mech,其中 sasl_mech 是 SASL 机制名称的空格分隔列表。请参见认证机制部分以了解这些字符串的描述。 Context.SECURITY_PRINCIPAL (...
如果要继续允许不在$external数据库中的用户进行访问,请确保authenticationMechanisms参数根据情况包括SCRAM-SHA-1和/或SCRAM-SHA-256。或者,应用上面列出的要求将这些用户转换到 LDAP 授权。 副本集 对于副本集,先对辅助节点和仲裁节点成员配置 LDAP 授权,然后再配置主节点。这也适用于分片副本集或配置服务器副本集。一...