SessionImpl createSession ( ConversationState user ) throws RepositoryException , LoginException { if ( IdentityConstants . SYSTEM . equals ( user . getIdentity ( ) . getUserId ( ) ) ) { // Need privileges to get system session. SecurityManager security = System . getSecurityManager ( ) ; if ( security != null ) { security . checkPermission ( JCRRuntimePermissions . CREATE_SYSTEM_SESSION_PERMISSION ) ; } } else if ( DynamicIdentity . DYNAMIC . equals ( user . getIdentity ( ) . getUserId ( ) ) ) { // Need privileges to get Dynamic session. SecurityManager security = System . getSecurityManager ( ) ; if ( security != null ) { security . checkPermission ( JCRRuntimePermissions . CREATE_DYNAMIC_SESSION_PERMISSION ) ; } } if ( SessionReference . isStarted ( ) ) { return new TrackedSession ( workspaceName , user , container ) ; } else { return new SessionImpl ( workspaceName , user , container ) ; } }
Creates Session object by given Credentials