Comments (19)
+1 (address book schema in general)
Outlook/thunderbird/evolution/whatever specificities could be done later. Believe me, there are many differences that are not that easy to do.
from node-ldapjs.
Thanks to clarify, right now, I'm indeed looking for a minimal common address book schema example that would work in most of the mail clients (eg sticking with a handful of needed fields, firstname+lastname+email) and that's it.
The weirdo ones that are only read by one version of one client can happily be left out.
X+
from node-ldapjs.
This might help:
http://tldp.org/HOWTO/archived/LDAP-Implementation-HOWTO/schemas.html
I don't have time to look into it right now but will try it probably tomorrow.
from node-ldapjs.
Basically, a contact should have cn
, (full name) sn
(surname), givenname
(first name) and mail
(default address).
from node-ldapjs.
Hi,
I'm not really sure what Thunderbird specifically needs, but this seems to align pretty closely with what dresende said:
https://wiki.mozilla.org/MailNews:LDAP_Address_Books
In terms of implementing there are two options here:
-
You roll with no schema and just do this by convention in code, which is probably the easier route.
-
There is, what I would classify as, "experimental" support for RFC-compliant LDAP schema in ldapjs, I just didn't doc it, 'cause I'm not sure I <3 the interface yet. It does work as I'm using it currently for some private stuff, and I've tested it with the schema that ships with OpenLDAP.
If you wanted (1), just script it out in an interceptor (if you need help, let me know). If (2), you should be able to just copy
in the OpenLDAP schema (it will have all those attributes), and load it up like:
ldap.loadSchema(config.schemaLocation, function(err, schema) {
if (err) {
console.error('Unabled to load schema: %s', err.stack);
process.exit(1);
}
server.add('o=example',
ldap.createSchemaAddHandler({
schema: schema
}),
function(req, res, next) { ... });
});
There's a schema interceptor for add/modify/search you can use like that. It's not really there yet for modify, since you need to have a way to tell it what the current entry is, and if the modification would violate the schema; hence why I didn't doc it yet ;).
Let me know if that's helpful?
m
from node-ldapjs.
I've tried it with Thunderbird and it works perfectly, at least for attributes "cn,sn,givenname,mail,o". Evolution makes a search using a very long filter which I think causes ldapjs to bark this:
2011-07-26 10:12:18Z WARN - Server: 127.0.0.1:52420 sent invalid protocol message
Here's the filter Evolution is sending:
(|(cn=ogo*)(givenname=ogo*)(sn=ogo*)(mail=ogo*)(member=ogo*)(primaryphone=ogo*)(telephonenumber=ogo*)(homephone=ogo*)(mobile=ogo*)(carphone=ogo*)(facsimiletelephonenumber=ogo*)(homefacsimiletelephonenumber=ogo*)(otherphone=ogo*)(otherfacsimiletelephonenumber=ogo*)(internationalisdnnumber=ogo*)(pager=ogo*)(radio=ogo*)(telex=ogo*)(assistantphone=ogo*)(companyphone=ogo*)(callbackphone=ogo*)(tty=ogo*)(o=ogo*)(ou=ogo*)(roomnumber=ogo*)(title=ogo*)(businessrole=ogo*)(managername=ogo*)(assistantname=ogo*)(postaladdress=ogo*)(l=ogo*)(st=ogo*)(postofficebox=ogo*)(postalcode=ogo*)(c=ogo*)(homepostaladdress=ogo*)(mozillahomelocalityname=ogo*)(mozillahomestate=ogo*)(mozillahomepostalcode=ogo*)(mozillahomecountryname=ogo*)(otherpostaladdress=ogo*)(jpegphoto=ogo*)(usercertificate=ogo*)(labeleduri=ogo*)(displayname=ogo*)(spousename=ogo*)(note=ogo*)(anniversary=ogo*)(birthdate=ogo*)(mailer=ogo*)(fileas=ogo*)(category=ogo*)(calcaluri=ogo*)(calfburl=ogo*)(icscalendar=ogo*))
(I searched for 'ogo')
Thunderbird is simpler:
(|(mail=ogo*)(cn=ogo*)(givenname=ogo*)(sn=ogo*))
from node-ldapjs.
My thoughts on the Evolution code not withstanding, thanks for this! I'll get that fixed up.
from node-ldapjs.
Actually, can you gist me some code of how you got that? I just created a simple test for that and it works fine.
from node-ldapjs.
Oh, alternatively, if you can grab a server trace, that would rock. In code, do this:
var ldap = require('ldapjs');
ldap.log4js.setLevel('Trace');
var server = ldap.createServer();
...
server.listen(389);
You can alternatively use the "real" log4js, but I mocked it up so people don't need to take it as a dependency if they don't want it. Anyway, doing that will spew a bunch of info to stderr, so grab that and put it somewhere, and I'll take a look at why you're seeing that ProtocolError when I'm not; I'm guessing it's something other than the filter, but I don't know what :)
m
from node-ldapjs.
Hmmm... weird. When that error showed I was still playing with ldapjs. Now that I completed my ldap addressbook and it works on Thunderbird, I tested again with Evolution and it's ok :)
That trace tip is usefull if I find anything in the future. The basic contact fields (name/email) are ok, now I'm going to try others (phones, addresses, contact pic?).
from node-ldapjs.
Ok, cool.
Oh - I should warn you about jpegPhoto (and any other binary attribute). LDAP (the wire protocol) will still send it as a UTF-8 string, but it will be base64 decoded, so to store it somewhere (at least if you're doing the obvious thing of writing out JSON), you'll probably want to base64 encode it before writing out the document (since a subsequent JSON.parse()
will implode). You'll also have to base64 decode again before doing a res.send()
in search.
m
from node-ldapjs.
Oh also, whenever you get the addressbook done it'd be awesome to slap it up as example code ;)
from node-ldapjs.
Sounds great!
@dresende, is this a real addressbook that you have done already or bits of code to return a minimal dummy data with a hardcoded minimal schema?
could you share the code you have in gist or somewhere?
X+
from node-ldapjs.
It's an addressbook for my company's e-mail product. It does fetch everything before starting the ldapjs. I'll detach the specific stuff and make a gist with it.
(currently it only has bind/search on one-level)
from node-ldapjs.
https://gist.github.com/1173999
It's pretty basic, but uses a mysql backend.
- database schema on the top;
- security is still very fragile :)
from node-ldapjs.
I'm going to go ahead and close this out; dresende, I'll snag that gist for the examples docs at some point soon.
from node-ldapjs.
Looks great thx for sharing. Will hack something using a rest server to provide the contact data (google contact API next ;). Let's see if the latency is as bad as I fear ;)
X+
from node-ldapjs.
Hey tttp,
That'll be awesome (and useful!). I'll be surprised if the latency isn't horrible - in which case if you want to do something where you just pull it down every N minutes (assuming your contact size isn't enormous), you could probably just mash together the schema dresende did with the "in memory" example on the examples page on ldapjs.org and some setTimeout puller. Writes are different problem though ;)
m
from node-ldapjs.
Just want to inform that Evolution saying "login with e-mail" translates to logging in with "cn=your-email-user,dc=domain-part,dc=...".
from node-ldapjs.
Related Issues (20)
- Obtaining search entry attribute value by key HOT 1
- Invalidate Error
- Whitespace in (old) parseFilter causes `Uncaught Error: missing paren`
- Module build failed: UnhandledSchemeError: Reading from "node:util" is not handled by plugins (Unhandled scheme). HOT 4
- SASL / GSSAPI support HOT 3
- Open ssl issue with node 18 HOT 1
- Compatibility Issue Between ldapjs Library and FreeRADIUS HOT 1
- Edited: Ldapjs doesn't work after next.js build HOT 5
- Sharing unescape DN code for helper method
- (node:536) [LDAP_MESSAGE_DEP_001] LdapjsMessageWarning: messageID is deprecated. Use messageId instead. HOT 1
- Missing LDAP Result Codes in errors.js HOT 1
- AttributeFilter not implemented on Server? HOT 3
- What is Naming Violation Error HOT 1
- LDAPJS Server: when searching, I need to request in lowercase attributes in order to get mixed-case attributes HOT 1
- Assistance Needed with LDAPS Connection to Windows Server 2012 R2 AD HOT 2
- TLS 1.3 not supported
- Why does the bind method call fail without throwing exception information? HOT 1
- Parse Error
- Get IP of a request
- problems changing passwords HOT 2
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 node-ldapjs.