Authorization in 2 different databases


#1

Nextcloud version (eg, 12.0.2): 12.0.3
Operating system and version (eg, Ubuntu 17.04): Ubuntu 16.04.3
Apache or nginx version (eg, Apache 2.4.25): Apache/2.4.18
PHP version (eg, 7.1): 7.0

The issue:
In NextCloud I need to implement authorization of users stored in external Postgre-database. The algorithm for hashing passwords in that DB:

Hash = SHA1 (salt + SHA1 (password));

the salt is stored in the same database.

“Native” (MySQL) authorization should remain.

Any ideas/suggestions how it can be done?