Closed cope closed 8 years ago
Based on this: https://github.com/mcavage/node-ldapjs/commit/408e7c9f9922e0121e870c33cd7c7dfa8eb285e9
I tried adding
LDAP_DEFAULTS.strictDN = false;
and I tried
Meteor.loginWithLDAP(lUsername, lPwd, {
strictDN: false,
but neither worked :(
@cope have you tried doing a successful bind
using only the ldapjs package + a plain node script?
No, sorry... I found another solution and moved on since the ROI on doing further research was just not there :(
@cope what was the v1db1 error that you where having? and how did you solved it?
I am having the following error myself:
80090308: LdapErr: DSID-0C0903A9, comment: AcceptSecurityContext error, data 52e, v1db1
I am troubleshooting with different dn values. I will try to do a bind with just ldapjs as typ90 suggests.
Regards.
Update: I did a script and still got the same error, did not matter how I passed the user name parameter (domain\user, user, or user@domain.com).
I tried with node-activedirectory (which uses ldapjs as its backend) and I am able to authenticate successfully (bind). So, I will need to look into node-activedirectory and see if I can use it with Meteor.
Regards.
@cope I figured out how to bind (authenticate) and search for a user. It turns out the that I had a few things wrong with my setup. I happened to come across the same error InvalidDistinguishedNameError
and it turned out to be the format. So a fully qualified DN is:
an attribute value assertion with = as the seperator, like: cn=foo where 'cn' is 'commonName' and 'foo' is the value.
so, in your case you DN may have been 'DC=mycompany,DC=com'
, I am not sure about the \cope
part though.
With regards to the issue I had above It turns out that I was indeed able to bind with the following combinations
'user@mycompany.com'
'company\\user'
'cn'
attribute for the user's recordThen the base was wrong. I was using 'OU=Users,DC=Example,DC=com'
, when I started researching the base parameters that where being successful with node-activedirectory, I derided to use 'DC=Example,DC=com'
instead, and the bind was successful. Once my base issue was addressed I moved on to finding the exact user.
I used the filter. In my case I had to use a different attribute that the one shown on the readme file.
The readme says
//on the server LDAP_DEFAULTS.base = 'OU=User,DC=your,DC=company,DC=com'; //on the client var domain = "yourDomain"; Meteor.loginWithLDAP(user, password, { dn: domain + '\\' + user, search: '(sAMAccountName=' + user + ')' } , function(err, result) { ... } );
I had to use the following:
//on the client
//
LDAP_DEFAULTS = {}; // this line makes the variable act as a global variable
LDAP_DEFAULTS.base = 'DC=example,DC=com';
LDAP_DEFAULTS.search = '(&(objectClass=person)({{username}}))'
// on my login function
// notice that I am using the form of user@example.com
// and that my LDAP_DEFAULTS variable is made global by defining
// it on a config.js file on the root of my project with the purpose of shearing
// the variable between client and server
// this part confused me, but I saw how the accounts-ldap module uses the parameter
// internally to perform the `client.bind(..)` call on the [ldap_server.js] @ line 101
// (https://github.com/typ90/meteor-accounts-ldap/blob/master/ldap_server.js#L101)
LDAP_DEFAULTS.dn = username;
// I replace the {{username}} placeholder with the input from the username field
LDAP_DEFAULTS.search = LDAP_DEFAULTS.search.replace("{{username}}", "mail="+username);
Meteor.loginWithLDAP(user, password, LDAP_DEFAULTS, function(err, result) { ... }
);
And it works.
@typ90 I suppose you can close this one.
After finally getting through the v1db1 authentication error, I got stuck at this one, and I have no idea what to try next :(