Multi tentant using encrypted password

Posted 4 years ago by kazehaya

Im having questions how i can achieve database acces using the encrypted password with Config::set.

This is how my code looks like:

    public function __construct()
        \Config::set('database.connections.tenant.username', Auth::user()->projects[0]->username);
        \Config::set('database.connections.tenant.password', Auth::user()->projects[0]->password);
        \Config::set('database.connections.tenant.database', Auth::user()->projects[0]->database);

Now its trying to make connection using the encrypted password inside my projects table and this does not work because the database password should be decrypted first. Another option i can think of is not storing a hashed password inside the projects table. But i think that would be a problem regarding security.

Hope someone has a solution for this

Please sign in or create an account to participate in this conversation.