I hope this is the appropriate location, if not I apologies in advance.
I have this some what unique requirement that when a user logs into my website the username/password needs to be used for the database connection as well. The app is based on EJB3.0 and JPA.
Currently I have a LoginModule which authenticates the user against a windows domain and then adds the ManagedConnectionFactory for the database, username and password into a PasswordCredential. This is added to the private credentials of the subject.
If you're still following at a latter point in time when the JBoss server will read the username and password out of the subject and provide them to the JDBC driver.
This almost works, but only for the first user, any users after that it uses the previous connection properties. Which I almost suspect would happen.
So the question: Am I going down the right path. Can I change the username/password of the jdbc connection for each user this way.
I will also take suggests on how to accomplish this any other way. My Fear is I will not be able to use EJB and have to create an EntityManagerFactory every time a user logs into the application.