I have just solved this problem myself.
The method is:
import javax.security.auth.Subject;
import com.sun.enterprise.security.SecurityContext;
Subject subject = SecurityContext.getCurrent().getSubject();
[Message sent by forum member 'erikengerd' (erikengerd)]
http://forums.java.net/jive/thread.jspa?messageID=245860