title: Adding additional details to principal object stored in spring security context
body: <p>I am using Spring 3.0 and Spring Security 3. I am able to authenticate a user against a database using Spring Security. Using:</p>
  
  <pre><code>SecurityContextHolder.getContext().getAuthentication().getPrincipal()
  </code></pre>
  
  <p>I am able to retrieve username of the current logged in user. I wish to add additional details like user id and the module accesses to the principal object stored in Spring Security context so that I can retrieve it later. How can I add additional details to the principal object and then how can I retrieve it later on a jsp or java class. Please provide an appropriate code snippet if possible.</p>
  
  <p>Edit: I am using JDBC to access my database.</p>
  
  <p>Thanks in advance.</p>