The actual security infrastructure items won't be visible inside the webapp. Not only would that be a potential security risk (the app user and the app itself could even have different security connections!), but also it wouldn't be possible in a transparent way. One of the great things about security realms is that you can use a tomcat-users.xml file for testing even though the production system is LDAP-authenticated.
However, you CAN set up a system where the info you want is inferred based on the user principal name, using that as an argument to an LDAP search.
The example you cited, however, seems to have more to do with database connections. And like security realms, in J(2)EE, database connections are generally best left completely in the hands of the container. You wouldn't (I hope!) get a different connection for each user! For one thing, it places the DBA in the position of having to duplicate the security team's work for each web application user.
Customer surveys are for companies who didn't pay proper attention to begin with.
subject: How can I read my context.xml's JNDIRealm settings dynamically?