Get JAAS Principal from custom DataSource implementation
I have implemented a custom DataSource and configured Glassfish to use it for my connection pool. This was done by setting Resources>JDBC>Connection Pool>myPool>Datasource classname and dropping the jar containing the class in glassfish/lib. This all works fine, but I have a few questions that I am hoping someone can help me with.
1. Do I have to drop the jar file in the glassfish/lib folder or is there a better place?
2. How do I access the authenticated JAAS principal in this file?
For question 2 I would have normally used @Resources to get my hands on SessionContext and get the principal from there, but this will only work if the class resides in a ejb-jar in a deployed ear, or at least as far as I know.
Thanks in advance.