I've done this before with a web app and don't recommend it, but you can make your own data source that wraps the jt400 version then use a thread local user to provide that.
The workflow is generally:
- inspect incoming request and set user in thread local storage
- process request
- clear user from thread local storage after request is processed
In your data source, you replace the getConnection() method with one that looks in the thread local storage for the user object, then calls getConnection(user, pass) and returns that connection. If you use a proxy for the wrapped connection, you can replace just that one method.
All that said...unless you have a VERY compelling reason to do this, I do NOT recommend it. It's messy and uses up a lot of resources. If you have a legacy green-screen system that is built on the actual system user, I get that it's convenient, but investigate other options.
Larry