Comments (6)
The way I've got it working (i.e. accepts email or username) with an active directory is to just use the default settings. i.e. not changing LDAP.searchField
or LDAP.searchValueType
.
It's so long since I've touched this part of the code, I can't really remember much about it. These are the default functions (that you can completely overwrite to get what you need):
LDAP.filter = function (isEmailAddress, usernameOrEmail, FQDN) {
var searchField = (_.isFunction(LDAP.searchField)) ? LDAP.searchField.call(this) : LDAP.searchField;
var searchValue = LDAP.searchValue.call(this, isEmailAddress, usernameOrEmail, FQDN);
return '(&(' + searchField + '=' + searchValue + ')(objectClass=user))';
}
LDAP.searchValue = function (isEmailAddress, usernameOrEmail, FQDN) {
var username = (isEmailAddress) ? usernameOrEmail.split('@')[0] : usernameOrEmail;
var searchValue;
var searchValueType = (_.isFunction(LDAP.searchValueType)) ? LDAP.searchValueType.call(this) : LDAP.searchValueType;
switch (searchValueType) {
case 'userPrincipalName' :
searchValue = username + '@' + FQDN;
break;
case 'email' :
searchValue = (isEmailAddress) ? userNameOrEmail : username + '@' + FQDN; // If it's not an email address, we're kind of guessing
break;
case 'username' :
default :
searchValue = username;
}
return searchValue;
}
from meteor-accounts-ldap.
Thanks a lot, I will try and let you know how that goes.
from meteor-accounts-ldap.
On reviewing the LDAP.searchValue
function above, it looks like the intention is for the userPrincipalName
option is to accept either a username or an email address. Not sure why the email address would be failing (unless the part of the email address before the @ is different from the username
for the user records in the AD).
from meteor-accounts-ldap.
Hey I just found out that , as you mentioned, the part of the email address before the @ is different from the username for the user records in the AD. You were right sir..
I have implemented your suggestion from the readMe and the code looks like this:
LDAP.multitenantIdentifier = 'organization_id';
LDAP.filter = function (isEmailAddress, usernameOrEmail, FQDN) { return '(&(' + ((isEmailAddress) ? 'mail' : 'userPrincipalName') + '=' + usernameOrEmail + ')(objectClass=user))'; }
LDAP.searchValue = function (isEmailAddress, usernameOrEmail, FQDN) {
var username = (isEmailAddress) ? usernameOrEmail.split('@')[0] : usernameOrEmail;
var searchValue;
var searchValueType = (_.isFunction(LDAP.searchValueType)) ? LDAP.searchValueType.call(this) : LDAP.searchValueType;
switch (searchValueType) {
case 'userPrincipalName':
searchValue = username + '@' + FQDN;
break;
case 'email':
searchValue = (isEmailAddress) ? userNameOrEmail : username + '@' + FQDN; // If it's not an email address, we're kind of guessing
break;
case 'username':
default:
searchValue = username;
}
return searchValue;
}
however, it is still not working on this situation.
Since I have only two possibilities for the login I have also tried this code but it also didn't work
LDAP.bindValue = function (usernameOrEmail, isEmailAddress, FQDN) {
LDAP.searchField = ((isEmailAddress) ? 'mail' : 'userPrincipalName');
LDAP.searchValueType = ((isEmailAddress) ? 'mail' : 'userPrincipalName');
return ((isEmailAddress) ? usernameOrEmail : usernameOrEmail + '@' + FQDN)
}
from meteor-accounts-ldap.
Apparently, having different email address than userPrincipalName is a very bad thing for the AD structure. Therefore we decided to use only userPrincipalName for the LDAP. I am closing this issue because the problem was caused by the AD not this repository. Thanks for the help
from meteor-accounts-ldap.
Thanks for following up. I appreciate it.
from meteor-accounts-ldap.
Related Issues (19)
- Custom filter HOT 7
- Question: Support Windows Integrated Authentication? HOT 1
- Connection to ldaps broken in Meteor 1.4+ HOT 4
- Loads of errors if the Meteor package 'accounts-password' is not already installed HOT 2
- installing bcrypt
- Failed to make it work with simple Active Directory HOT 5
- No compatible binary build.... HOT 3
- Use with openLDAP HOT 12
- settings.json not found HOT 2
- thumbnailPhoto stored as string HOT 3
- Latest version 0.7.6 not available HOT 2
- what happens if server is down HOT 3
- Ldap errors out with "In order to perform this operation a successful bind must be completed on the connection., data 0, v2580\u0000" HOT 1
- "Future resolved more than once" error HOT 3
- Error: Cannot find module './build/Release/DTraceProviderBindings'] code: 'MODULE_NOT_FOUND' HOT 5
- Error: Future resolved more than once HOT 37
- unable to install package HOT 3
- issue with serverDNs[k].split(/,?DC=/).slice(1).join('.'); HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from meteor-accounts-ldap.