Coder Social home page Coder Social logo

LDAP auth about sails-auth HOT 2 CLOSED

ionutchirvasa avatar ionutchirvasa commented on September 4, 2024
LDAP auth

from sails-auth.

Comments (2)

danieltjewett avatar danieltjewett commented on September 4, 2024

@ionut72 Were you able to figure this out? If so, could you share? I've been researching this on and off for the last few weeks in my spare time, with no luck. I currently get a Failed to serialize user into session error.

from sails-auth.

ionutchirvasa avatar ionutchirvasa commented on September 4, 2024

@danieltjewett
I was able to implement this feature using vesse/passport-ldapauth and created ./config/passport.js with a new provider( see issue #79 for more details).

  • ./api/services/protocols/ldaputh.js - my custom protocol callback function
  • ./api/services/protocols/index.js - add your custom protocol callback to existing protocols that now point to sails-auth protocols directory
  • ./api/services/passport.js - extend with protocols: require('./protocols') to load your new protocol list
  • ./config/passport.js - your ldapauth protocol config

The reason why you get that error is because you have no id attribute set to your returned user model. To fix this you have to call sails.services.passport.loadStrategies(); after sails boots in order to correctly load your custom ldapauth protocol(here you map LDAP result to you user schema).

I called loadStrategies in ./config/bootstrap.js like this:
sails.on('lifted', function() { sails.services.passport.loadStrategies(); });

To authenticate you have to use this route: /auth/:provider/callback. I've created a new entry to allow POST requests.

from sails-auth.

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.