I am trying to access the subject in an ejb3 session bean so that one of the Subject's Principal's can be used for some auditing information.
My subjects have several different principals including emailAddress and subjectID. When I make a call to SecurityAssociation.getSubject from within a session bean method it returns null . How ever, when I make the same call from an interceptor on the session method, the call returns the subject fine. Why then can I not access the subject from within the session bean method itself??
I have also tried using:
Subject subject = (Subject) PolicyContext.getContext("javax.security.auth.Subject.container");