Create database accounts for users and use another database account to validate users. Once you have a valid db username and password, use those to connect to the database.
Make sure NOT to use persistent connections for these db connections (except for the validation connection) because you'll run out of connections or have a lot you don't need.