I try to get the subject to store an additional principal containing UserId for audit purposes (subquestion: Is that a good idea). Unfortunately I get always another subject instance so I can't persist the UserId.
this are my lookup trials:
Subject subject = (Subject) PolicyContext.getContext("javax.security.auth.Subject.container");
Subject subject = (Subject) ic.lookup("java:jaas/tmsec/subject");
I always get a subject contained principals with correct username and roles.
Has somebody an idea if the lookup has to be done different or if possibly something is missing somewhere else?
I use jboss-4.2.3.GA
Thanks in advance
Now I have written my own LoginModule where I return a modified principal containing the userId. Seems to work. Anyway, if someone has ha better solution please note.