in impl/src/main/java/org/apache/directory/fortress/realm/J2eePolicyMgrImpl.java [132:148]
private TcPrincipal createSession( User user ) throws SecurityException
{
Session session = accessMgr.createSession( user, false );
LOG.debug( "{}.createSession userId [{}], successful", CLS_NM, user.getUserId() );
HashMap<String, Object> context = new HashMap<String, Object>();
context.put( SESSION, session );
// now serialize the principal:
String ser = serialize( session );
// Store the serialized principal inside the context hashmap
// which allows overriden toString to return it later, from within an application thread.
// This facilitates assertion of rbac session from the tomcat realm into the web application session.
context.put( TcPrincipal.SERIALIZED, ser );
return new TcPrincipal( user.getUserId(), context );
}