-
-
Notifications
You must be signed in to change notification settings - Fork 751
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
Using a custom passport strategy like passport-saml #1074
Comments
Hi @hhaidar. Quick review of SAML (and its terminology) before we dive into the Feathers side of this. In SAML authentication, there are two actors: (1) the Identity Provider ("IdP") and (2) the Service Provider ("SP"). If you're building a service that relies on external authentication, your service would be considered the SP and the site where users actually login is the IdP. So usually, when you're using SAML authentication (in my experience at least), you receive HTTP POST requests at a pre-defined endpoint (e.g., So, it'll be up to you to inspect the validated response object for the relevant information you'll need. If the user from the IdP has never logged into your service before, they obviously won't exist in your users database. So you'd need to create a record, or find the existing user's record. Then, you can jump back into feathers and create the authentication token: const {accessToken} = await app.service('authenticationService').create({}, {payload: {userId: user.id}}); It sounds like (for your use case) there may be no associated user. In that case, you still want to validate the response you receive at your endpoint (to prevent a bad actor from maliciously crafting an authentication request). In this case, after you've validated the response, just create an authentication token, but without associating information, like a userId, like so: const {accessToken} = app.service('authenticationService').create({}, {payload: {}}); How you want to wire it up, is up to you. But you're going to have to take the generated Overall, the question you pose ...is it possible to integrate Feathers with SAML authentication... the answer is yes! I think it's easier to grasp the implementation with a solid understanding of (1) how the SAML protocol works and (2) Feather's authentication API's. |
@petermikitsh thank you so much, |
@hhaidar There's some documentation here: https://docs.feathersjs.com/api/authentication/server.html#servicecreatedata but you're right, it isn't complete -- it doesn't explain how to add a |
This is another good time for me to mention that the documentation is easily and freely editable by anybody with a GitHub account. Any corrections or additions would be very welcome. |
Closed via feathersjs/docs#1225 |
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. |
Hey!
I apologize if this has been asked before, but are there more details on how to get a custom strategy (like SAML) working with feathers?
I've tried @petermikitsh's SAML gist but the tokens being generated by the authentication service are not associated with a user (looks like they're anonymous?). It's also not particularly clear if this is the recommended approach and it seems a bit haphazard.
The text was updated successfully, but these errors were encountered: