0

When a user log in into my application, the credentials are the data for the database (user and password in a doctrine connection configuration). I wrote a AuthenticationProvider. He checks if the user can login with the data. If so, the token with the credentials is stored in the TokenStorage.

Now I overwrote the doctrine ConnectionFactory to add the credentials to the connection data, but the TokenStorage has always no token.

You can find the source code example here: https://github.com/fadoe/playground-dbauth

The login works fine, but when I create the database connection the TokenStorage is empty. I'am logged in as user. Can it be the firewall?

Falk
  • 1
  • 3
  • 1
    So you want to access the database layer with an application user if i understand it correctly ? Why would you need that if I may ask ? – Jeroen Jul 31 '18 at 07:02
  • The database is so designed. Every user how can login is a DBMS user. And his privileges are managed by the DBMS, too. – Falk Jul 31 '18 at 07:17
  • Well still not quite sure why you want to create a separate DB user for each application user. But nevertheless you should show some related code, what did you try and where does it go wrong ? – Jeroen Jul 31 '18 at 08:42
  • It's not my idea. I only must write a web interface for the database. You can find the code here: https://github.com/fadoe/playground-dbauth After login you should see on the dashboard the database connecton dump with the login credentials. When you click in the menu the db connection still works with the credentials. – Falk Jul 31 '18 at 10:29
  • possible ideas: https://stackoverflow.com/questions/16762686/dynamic-database-connection-symfony2 and https://stackoverflow.com/questions/15108732/symfony2-dynamic-db-connection-early-override-of-doctrine-service/24585284#24585284 – LBA Jul 31 '18 at 14:55
  • and a Gist: https://gist.github.com/samsch/9dd2cec7f21a3e879fd5 – LBA Jul 31 '18 at 14:56
  • @LBA Thank you for the links. I get some ideas from this. My biggest problem is: Why is the Tocken after login empty here: https://github.com/fadoe/playground-dbauth/blob/master/library/DbAuthBundle/src/Doctrine/DynamicConnectionFactory.php. Is it a firewall problem? – Falk Aug 01 '18 at 05:49
  • then please re-phrase your question if it has nothing to do with the database login. i even suggest to create a new question and you provide your custom authenticator code, config etc there. – LBA Aug 01 '18 at 11:56
  • I updated the question. Source code is also provided in a git repo. – Falk Aug 01 '18 at 13:29

0 Answers0