MODE-1270 Add support for setting Session's user ID based upon JAAS Subject in J2EE The standard way to get the current JAAS Subject given t…
MODE-1270 Add support for setting Session's user ID based upon JAAS Subject in J2EEThe standard way to get the current JAAS Subject given the LoginContext or AccessControllerworks in standard Java but not in J2EE. Apparently this is a well-known issue. The recommendedapproach for J2EE is to instead get the Subject via the JACC API.This change adds an optional (e.g., "provided") dependency on the JACC API, changesthe JaasProvider implementation to accept an optional SubjectResolver implementationthat the provider will use to resolve the Subject should the standard JAAS techniquenot work, and to change the JcrRepository implementation to give the JaasProvidera new JaccSubjectResolver implementation (when the JACC API is available).It is not really possible to test whether this technique works in our unit or integrationtests (as we don't deploy to a J2EE container). However, all existing unit and integrationtests do pass (meaning it doesn't break their functionality), and Kurt is verifyingthat the JACC-style approach works within Guvnor and will (after this commit) verifythat these changes do indeed work within Guvnor (which uses Seam in JBoss AS).