feathersjs-ecosystem / authentication-local

[MOVED] Local authentication plugin for feathers-authentication
https://github.com/feathersjs/feathers
MIT License
26 stars 15 forks source link

Adding separate entity username and password fields #23

Closed adamvr closed 7 years ago

adamvr commented 7 years ago

Summary

This pull request adds the options entityUsernameField and entityPasswordField, corresponding to the fields on the user entity that contain the username and password fields respectively. If these options are not defined the username and password fields default back to usernameField and passwordField, maintaining backwards compatibility. This allows the separation of the {username,password}Fields on the user entity and on the incoming authentication request.

Concretely, this allows the following use case:

authentication-local options:

{
  entityUsernameField: 'services.email.address',
  entityPasswordField: 'services.email.password'
}

authentication request:

{
  strategy: 'local',
  username: 'test@email.com',
  password: 'test'
}

user entity:

{
  services: {
    email: {
      address: 'test@email.com'
      password: 'test'
    }
  }
}

Open questions

marshallswain commented 7 years ago

Thanks for the solid PR!

ekryski commented 7 years ago

Yup thank you! @marshallswain I think this should be good to merge and release as well. :shipit: