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

How to add custom passport strategy #440

Closed
abartolo opened this issue Oct 21, 2016 · 4 comments
Closed

How to add custom passport strategy #440

abartolo opened this issue Oct 21, 2016 · 4 comments

Comments

@abartolo
Copy link

abartolo commented Oct 21, 2016

Hello,

I've been stuck trying to understand how to add custom passport strategy to the authentication. Looking forward to using Feathers for my new app but in order to move from my old express app I need to get this authentication piece working.

In my current Express App I have the following strategy below...

`
var passport = require('passport');
var jwt = require('jsonwebtoken');
var AtlassianCrowdStrategy = require('passport-atlassian-crowd').Strategy;

passport.use(new AtlassianCrowdStrategy({
  crowdServer: "...",
  crowdApplication: "..",
  crowdApplicationPassword: "..",
  retrieveGroupMemberships: true
}, function atlassianCrowdStrategyCustomCallback(userprofile, done) {


  console.log("Inside Crowd Strategy Custom Callback");

  // if user in DB then return user
  // else create user in DB.



  // Return
  return done(null, {
    user: doc.value
  });

}));

`

Is there a way or do I have to create a separate route and hooks?

@daffl
Copy link
Member

daffl commented Oct 29, 2016

This is a little tricky in the current version (0.7) but we're just about to wrap up feathersjs-ecosystem/authentication#336 which will make it much easier.

@abartolo
Copy link
Author

@daffl thanks for the reply. This is a crucial piece for my project so I ended up using express alone since I didn't want to break anything in Feathers.. I've been following up with feathers and looking forward using it in my future project. I read alot of great things on its way.

@daffl
Copy link
Member

daffl commented Oct 29, 2016

You can always come back. Feathers is a drop-in replacement for Express (literally replacing require('express') with require('feathers')) so what you did in Express will work with Feathers as well. What feathers-authentication does additionally is to take care of making sure websockets are authenticated the same way.

@lock
Copy link

lock bot commented Feb 7, 2019

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue with a link to this issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Feb 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants