• Home
  • Categories
  • Recent
  • Popular
  • Top
  • Tags
  • Users
  • Groups
  • Documentation
    • Home
    • Read API
    • Write API
    • Plugin Development
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
v3.5.2 Latest
Buy Hosting

Creating own sso for login from other database

Scheduled Pinned Locked Moved NodeBB Development
2 Posts 2 Posters 1.2k Views
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • smartameerS Offline
    smartameerS Offline
    smartameer GNU/Linux
    wrote on last edited by smartameer
    #1

    Hello,

    I have my own database, from which I want user to login, where the password keeps changing each month. So I don't want user to create account in nodebb again. I tried creating an sso plugin for overriding login but till now I am not sure to get the request data from the user i.e. username/email and password which he/she is entering.

    I have seen firehook of overriding login and its not sending any of the user input parameters.

    Ref: https://github.com/NodeBB/NodeBB/blob/master/src/routes/authentication.js#L41

    1 Reply Last reply
    0
  • yariplusY Offline
    yariplusY Offline
    yariplus Community Rep
    wrote on last edited by
    #2

    I am guessing on all of this, never done it before

    It sounds as if you want to override the local login strategy rather than provide an SSO service.

    To do this you need to provide a local login strategy to passportjs during that hook, just as the core does here:
    https://github.com/NodeBB/NodeBB/blob/master/src/routes/authentication.js#L43

    Instead of controllers.authentication.localLogin, use your own callback function. It is passed (req, username, password, next) just as it is here.

    You would essentially the same thing that function does, but instead of using the local user info, use your own database to compare the username/passwords too.

    If the login is successful, you need to create a local user and attach an ID from your database entry to the user's local database entry, so you can look that up when the user logs in again.

    Also in the admin panel, change the registration type to none, so that users are required to have an account at your existing db.

    1 Reply Last reply
    0

Copyright © 2023 NodeBB | Contributors
  • Login

  • Don't have an account? Register

  • Login or register to search.
Powered by NodeBB Contributors
  • First post
    Last post
0
  • Home
  • Categories
  • Recent
  • Popular
  • Top
  • Tags
  • Users
  • Groups
  • Documentation
    • Home
    • Read API
    • Write API
    • Plugin Development