public static async Task <Authentication> LoginRandomAsync(this ICremaHost cremaHost, Authority authority, Func <IUser, bool> predicate)
        {
            if (cremaHost.GetService(typeof(IUserCollection)) is IUserCollection userCollection)
            {
                var userFlags  = AuthorityUtility.ToUserFlags(authority) | UserFlags.Offline | UserFlags.NotBanned;
                var userFilter = new UserFilter(userFlags);
                var user       = await userFilter.GetUserAsync(cremaHost);

                var name     = user.ID;
                var password = user.GetPassword();
                var token    = await cremaHost.LoginAsync(name, password);

                return(await cremaHost.AuthenticateAsync(token));
            }
            throw new NotImplementedException();

            bool Test(IUser user)
            {
                if (user.BanInfo.Path != string.Empty)
                {
                    return(false);
                }
                if (user.UserState == UserState.Online)
                {
                    return(false);
                }
                if (user.Authority != authority)
                {
                    return(false);
                }
                return(predicate(user));
            }
        }
        public static async Task <Authentication> LoginAgainAsync(this ICremaHost cremaHost, Authentication authentication)
        {
            if (cremaHost.GetService(typeof(IUserCollection)) is IUserCollection userCollection)
            {
                var user = await userCollection.GetUserAsync(authentication.ID);

                var name     = user.ID;
                var password = user.GetPassword();
                await cremaHost.LogoutAsync(authentication);

                var token = await cremaHost.LoginAsync(name, password);

                return(await cremaHost.AuthenticateAsync(token));
            }
            throw new NotImplementedException();
        }