How do I get the Hibernate caller principal inside established from within an auditing interceptor?
Issue
- I need to get the "caller principal" from within Hibernate in a "Stateless Session Bean/Hibernate architecture" that uses different ways to establish user identity.
- Once inside the EJB layer, I have Hibernate saving entities. Hibernate uses an auditing Entity Interceptor which must get the caller principal and set audit field in the database.
-
How do I get the caller principal inside established from either one of these login techniques from within this auditing interceptor?
Subject caller = (Subject) PolicyContext.getContext("javax.security.auth.Subject.container");
Environment
- JBoss Enterprise Application Platform (EAP) 5
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.