Files
DataManagerSystem/src/backend/service/interfaces/AuthService.java

49 lines
1.3 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package backend.service.interfaces;
/**
* 认证服务接口
* 提供用户认证和权限管理相关功能
*/
public interface AuthService {
/**
* 用户登录验证
* 验证用户名和密码是否匹配,如果匹配则允许用户登录系统
*
* @param username 用户名
* @param password 密码
* @return 登录成功返回true失败返回false
*/
boolean login(String username, String password);
/**
* 用户注册
* 创建新的用户账户,将用户信息存储到系统中
*
* @param username 用户名
* @param password 密码
* @param email 邮箱地址
* @return 注册成功返回true失败返回false
*/
boolean register(String username, String password, String email);
/**
* 用户登出
* 使指定用户的会话失效,结束用户的登录状态
*
* @param userId 用户唯一标识符
* @return 登出成功返回true失败返回false
*/
boolean logout(int userId);
/**
* 权限检查
* 检查指定用户是否具有所需的权限角色
*
* @param userId 用户唯一标识符
* @param requiredRole 所需的角色权限
* @return 具有权限返回true无权限返回false
*/
boolean hasPermission(int userId, String requiredRole);
}