User authentication handled by a web service I seek your help and advice. By default, Drupal manages user authentification using the user module that resides in the "core/modules" and through the main Drupal Database. In my case, the user is authenticated through an external webservice, the process is as follow:
1- The user enters his credentials and click submit
2- the credentials are then sent to the webservice
3- the webservice checks the data(credentials) to the one he has in his database
4- upon validation the webservice sends a token (JWT) otherwise it sends 401 Unauthorized

PS: the admin will have normal login (through Drupal Database)

The question is how can I proceed to elaborate this process of authentification?


Is there some existing modules that could help with this?
should I override the existing user module or create a new module?


Any info will be of great help.
Remote authentication can range from moderately complex to major complex.  

In general, you will need Drupal users that match your external DB users.  Drupal security and coding is tied to this.  The easiest way is to create users that match your remote DB and then only do authentication.

How you syncing the remote to the local can quickly add complexity.

Other things you will need to deal with are overriding the password reset functionality.  Changing it in Drupal will not change it in your remote DB.

Some reference material / modules to look at:

Authentication API (incomplete)

The LDAP Project - A full featured implementation with dynamic provisioning (creates local Drupal id's if user authenticated) and other stuff.

The External Auth Module - Just ran across this.  May or may not be applicable.