-
Notifications
You must be signed in to change notification settings - Fork 458
Unable to match DN in ldapjs@3.0.0 version #947
Comments
How to Extract RDNs |
Please provide a minimal reproducible example (MRE). Doing so will help us diagnose your issue. It should be the bare minimum code needed to trigger the issue, and easily runnable without any changes or extra code. Please review the integration tests, e.g. issue-940.test.js, for examples of good MREs. You may use a GitHub repository to host the code if it is too much to fit in a code block (or two). |
They did provide a MRE, albeit terribly formated and obviously a coding error, a catch all that returns false and an error before. rdns is now considered private and you cannot call map on it. I suggest to look at Note that dns a few more public function than mentioned in the docs (but I think not needed here) IMO with this this can be closed. |
if rdns is an array of rdn objects, why make rdns private? There are useful functions in the rdn object to use, but you can't get at them... I'm not following now to use a dn object, similar to this guy's question. And, the docs say to reference the rdns object in dn.rdns, so.....I'm guessing it's just outdated docs. |
I want to match subject and get output "true" but getting "false" in ldapjs version 3.0.0, it was "true" in ldapjs version 2.3.3.
import ldapjs from 'ldapjs';
function subjectMatches(actual, expected) {
try {
const actualDN = ldapjs.parseDN(actual);
const expectedDN = ldapjs.parseDN(expected);
const actualRDNs = actualDN.rdns.map(rdn => rdn.toString());
const expectedRDNs = expectedDN.rdns.map(rdn => rdn.toString());
const checker = (arr, target) => target.every(v => arr.includes(v));
if (actualRDNs.length != expectedRDNs.length || !checker(expectedRDNs, actualRDNs)) {
throw new Error('invalid tls_client_auth_subject_dn claim');
}
} catch (err) {
return false;
}
return true;
}
// Certificate, eidas, subject DN, RDNs
console.log(
subjectMatches(
'CN=875HGJHJHJ,organizationIdentifier=xyz-abc-123,O=ABC,C=GB',
'CN=875HGJHJHJ,organizationIdentifier=xyz-abc-123,O=ABC,C=GB',
),
);
The text was updated successfully, but these errors were encountered: