我在LDAP上有一个用基本DN命名的用户
=CN=abc def\, ghi,CN=jkl,DC=mno,DC=pqr
,密码为xyz
。
我想在ldap中搜索此用户,该怎么做?一件事很清楚,LDAP查询应该像
CN=abc def\\\, ghi\,CN=jkl\,DC=mno\,DC=pqr,xyz
尝试了这些解决方案
.getBindUserDN().replaceAll("[,]", "\\\\\\,").getBindUserDN().replaceAll(",", "\\,")
等这里的逻辑应该是什么?
答案 0 :(得分:0)
我找到了解决方案,但是它非常针对这种情况,我们只指定一个反斜杠function getAuthUrl() {
var oauth2Client = getOAuthClient();
// generate a url that asks permissions for Google+ and Google Calendar scopes
var scopes = [
'https://www.googleapis.com/auth/userinfo.profile',
'https://www.googleapis.com/auth/userinfo.email',
'https://www.googleapis.com/auth/gmail.readonly',
'https://www.googleapis.com/auth/gmail.compose',
'https://www.googleapis.com/auth/gmail.send',
'https://www.googleapis.com/auth/gmail.modify',
'https://www.googleapis.com/auth/gmail.insert',
'https://www.googleapis.com/auth/gmail.metadata',
];
var url = oauth2Client.generateAuthUrl({
access_type: "offline",
scope: scopes
});
return url;
和一个逗号\
即,
问题在于,当我尝试搜索ldap条目时,我直接采用了\,
的值。后来经过反复试验,我了解到,当我搜索它的私钥时,我们需要6个反斜杠,即Bind DN
才能找到它的私钥,因为LDAP使用3个反斜杠和逗号\\\\\\
来存储它。< / p>
但是当我要寻找Ldap的这个秘密密钥时,现在我需要使用这个新的秘密密钥进行搜索,这意味着应该有6个反斜杠。因此,我必须使用这些反斜杠数量的两倍来搜索它,即12 \\\,
\\\\\\\\\\\\