重构用户登录服务,引入Spring Security和JWT认证机制 - 新增JwtUtils工具类处理JWT生成与验证 - 添加JwtAuthenticationFilter拦截请求验证token - 实现UserDetailsService从数据库加载用户信息 - 创建AuthController处理登录请求返回JWT - 重构用户角色权限相关接口,支持基于角色的访问控制 - 移除旧的安全配置,启用新的SecurityConfig - 新增LoginResponse DTO替代旧的LoginUser - 优化用户密码加密存储,使用BCryptPasswordEncoder
23 lines
623 B
Java
23 lines
623 B
Java
/*
|
||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template
|
||
*/
|
||
|
||
package com.qf.backend.service;
|
||
|
||
import com.qf.backend.common.Result;
|
||
import com.qf.backend.dto.LoginResponse;
|
||
|
||
/**
|
||
* 用户登录服务接口
|
||
*/
|
||
public interface UserLoginService {
|
||
/**
|
||
* 用户登录
|
||
* @param username 用户名
|
||
* @param password 密码
|
||
* @return 登录结果,包含登录状态、token等信息
|
||
*/
|
||
Result<LoginResponse> login(String username, String password);
|
||
}
|