public static function resetUserIdentity(AUser $user = NULL, $duration = null) {
        static::$userId = new UserIdentity($user, $duration);
        if (!$user)
            Session::reset();
        static::saveSession();
    }