GithubHelp home page GithubHelp logo

Wildcard op / middleware about node-ldapjs HOT 10 CLOSED

ldapjs avatar ldapjs commented on June 4, 2024
Wildcard op / middleware

from node-ldapjs.

Comments (10)

mcavage avatar mcavage commented on June 4, 2024

Hi Falco,

So by wildcard operator, you mean "ignore the tree" altogether? I like the idea of a .use() paradigm (I kind of had something like that somewhere along the line, but it wasn't clear that most uses would want to implement all the LDAP operations, so I never got around to stubbing). I'm not sure that I like the idea of server.use(function(req, res, next)) without a mount point, since you would be effectively banning rootDSE, or any other logic (I almost always mount a handler for an admin user/group for example). But otherwise it should be doable.

m

from node-ldapjs.

fnogatz avatar fnogatz commented on June 4, 2024

Not just ignoring the tree but also the OP. For my use case a connect-like server.use('o=example', function(req, res, next){}) would be enough but I can image scenarios where you want do an action for every single request ignoring what it exactly does, e.g. logging.

from node-ldapjs.

mcavage avatar mcavage commented on June 4, 2024

Oh - I forgot to mention, the common case (imo) for wildcarding the operation is "post" action items (i.e., log). So in master as of today or yesterday is a new .after() method that takes a chain of handlers that are guaranteed to be invoked after the last of your "normal" chains, regardless of whether an error was sent.

from node-ldapjs.

fnogatz avatar fnogatz commented on June 4, 2024

Okay, the .after() method is really a good way for post operations like logging. Nevertheless it would be nice to implement a server.use('o=example', function(req, res, next)) which would make proxying and caching easier.

from node-ldapjs.

mcavage avatar mcavage commented on June 4, 2024

Yeah, not disputing that. I was just asking about server.use(function...) only :)

from node-ldapjs.

dresende avatar dresende commented on June 4, 2024

I missed this also, i.e., having a callback that would receive every OP request careless of that rdn is sent.

Question (can't test now): If I have a server.search("o=example", cb), will this receive requests for *, o=example or just o=example ?

from node-ldapjs.

mcavage avatar mcavage commented on June 4, 2024

In that example server.search('o=example', function(req, res, next) {}) will match o=example and *, o=example (i.e., all children). The ldapjs "router" does dn.parentOf($requested_dn)

from node-ldapjs.

dresende avatar dresende commented on June 4, 2024

Great! All I needed to ear :)

from node-ldapjs.

mcavage avatar mcavage commented on June 4, 2024

Wow, sorry I forgot about this one. It's in [email protected] now. There's a server.use() now:

server.use(function(req, res, next) { console.log('hi!'); return next(); });
server.search(...);

from node-ldapjs.

fnogatz avatar fnogatz commented on June 4, 2024

Hi Mark,
thanks, that's exactly what I (still) needed!

from node-ldapjs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.