using System.Collections.Generic; public enum UserRole { Admin, User } public class CurrentUser { public string Username { get; set; } public UserRole Role { get; set; } } /// /// 扩展认证服务接口,支持用户管理功能 /// public interface IAuthenticationService : IService { bool Login(string username, string password, out UserRole role); void Logout(); bool IsLoggedIn { get; } string CurrentUsername { get; } UserRole CurrentRole { get; } CurrentUser CurrentUser { get; } // 用户管理功能 bool AddUser(string username, string password, UserRole role); bool RemoveUser(string username); bool ChangePassword(string username, string oldPassword, string newPassword); bool ValidCurrentPassword(string password); List GetAllUsers(); // 用户统计信息 int GetUserCount(); int GetMaxUserCount(); }