title: Tomcat-Jaas - How to retrieve subject?
body: <p>I'm studying JAAS and I'm implementing a simple example to use in a webapp using Tomcat with a JaasRealm. </p>
  
  <p>Now my problem is that I don't know how to retrieve the subject since code like <code>Subject subject = Subject.getSubject(AccessController.getContext());</code> always returns null.</p>
  
  <p>I'm using Tomcat 7.0.27. Is there something I've missed?
  In other terms how can I manage authorization in Java EE with JAAS? For example how can I implement an action within the secure context of JAAS?</p>