strongloop / loopback-component-oauth2

oAuth 2.0 server for LoopBack
http://www.strongloop.com
Other
62 stars 63 forks source link

Is it possible to authorize on a remote server #66

Closed mbouclas closed 7 years ago

mbouclas commented 7 years ago

Ideally i would like to override the default flow that tries to login the user in the local instance and have it done elsewhere. The idea is to validate the login to another non loopback server and return the outcome to loopback. I've so far made all the way to the part that the password needs to be validated, in userLogin function which is done in 2 parts, which is killing it for me.

 function userLogin(username, password, done) {
    debug('userLogin: %s', username);
    models.users.findByUsernameOrEmail(username, function(err, user) {

      if (err) {
        return done(err);
      }
      if (!user) {
        return done(null, false);
      }

      user.hasPassword(password, function(err, matched) {
        if (err || !matched) {
          return done(err, false);
        }
        done(null, user);
      });
    });
  }

I managed to override models.users.findByUsernameOrEmail with my own implementation which requests info from the remote server, but then i need ti verify the password...

There must be a much simpler way, right?

stale[bot] commented 7 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 7 years ago

This issue has been closed due to continued inactivity. Thank you for your understanding. If you believe this to be in error, please contact one of the code owners, listed in the CODEOWNERS file at the top-level of this repository.