title: Add information to the subject on apache shiro
body: <p>Im using apache shiro. When i want to know if the user have permissions and roles i use SecutiryUtils.getSubject(). I like to know how to add more information to the subject like email, primary key and any other business information that i need so i can retrieve that information when necessary.</p>
  
  <p>This is my shiro.ini:</p>
  
  <pre><code>[main]
  ds = org.apache.shiro.jndi.JndiObjectFactory   
  ds.requiredType = javax.sql.DataSource  
  ds.resourceName = java:/comp/env/jdbc/myDS
  
  # JDBC realm config  
  jdbcRealm = com.mycompany.JdbcRealmImpl
  jdbcRealm.permissionsLookupEnabled = true 
  jdbcRealm.authenticationQuery = SELECT password FROM user WHERE username = ? AND status = 1
  jdbcRealm.dataSource = $ds
  
  sha256Matcher = org.apache.shiro.authc.credential.Sha256CredentialsMatcher
  jdbcRealm.credentialsMatcher = $sha256Matcher
  
  [urls]
  /logout = logout
  /** = authcBasic
  </code></pre>
  
  <p>This is my JdbcRealm</p>
  
  <pre><code>public class JdbcRealmImpl extends JdbcRealm {
  
      public JdbcRealmImpl() {
          super();
      }
  
      @Override
      protected AuthenticationInfo doGetAuthenticationInfo(
              final AuthenticationToken token) throws AuthenticationException {
  
          final AuthenticationInfo info = super.doGetAuthenticationInfo(token);    
  
          // create a user to test
          final User user = new User();
          user.setId(11111);
  
          return new SimpleAuthenticationInfo(user, info.getCredentials(),
                  getName());
      }
  
  }
  </code></pre>
  
  <p>And here is the code where i try to retrieve the user info.</p>
  
  <pre><code>    final Subject currentUser = SecurityUtils.getSubject();
      final User user = (User) currentUser.getPrincipal();
      // null
      System.out.println(user); 
  </code></pre>