Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend / Override Protocol #123

Open
dottodot opened this issue Feb 2, 2016 · 2 comments
Open

Extend / Override Protocol #123

dottodot opened this issue Feb 2, 2016 · 2 comments

Comments

@dottodot
Copy link

dottodot commented Feb 2, 2016

I'm wanting to make some changes to the way the local protocol works in particular the login but can't work it out. In my app api > services > protocols > local.js I would have assumed something like the following would have giving me the ability to override it but it doesn't do anything

var _ = require('lodash');
var _super = require('sails-permissions/api/services/protocols/local');

function protocols () { }

protocols.prototype = Object.create(_super);
_.extend(protocols.prototype, {

  login: function (req, identifier, password, next) {
    console.log(req);
  }

});

module.exports = new protocols();
@mneil
Copy link

mneil commented Jan 30, 2017

I would also like to see this added. I've dug through the code now for a few hours and as far as I can tell there actually isn't a way to add any other passport strategies than the ones supported by the plugin. The "et al" in the docs is overstated.

The issue is that all passport strategies require a callback.

  • The options passed in must be an object. This means setting options: function(){} does not work in config.
  • The second argument passed to new strategies is the protocol

While you can define the protocol to use it seems impossible to change the services protocol at runtime before the strategy is instantiated but after the config is loaded.

@fulminant
Copy link

I have the same problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants