feat(auth): 添加飞书OAuth登录及Sa-Token集成
- 新增飞书OAuth认证控制器,支持code登录回调接口 - 实现登录状态检查接口,返回当前登录信息 - 增加Sa-Token配置,设置登录拦截和全局过滤器 - 配置Sa-Token排除登录、注册、飞书登录等路径免验证 - 配置跨域请求响应头,支持OPTIONS预检请求处理 - 添加application.yaml,配置spring、server和sa-token相关参数 - 新增pom.xml,包含Spring Boot、Sa-Token、飞书SDK及文档解析依赖等
This commit is contained in:
@@ -28,10 +28,9 @@ public class SaTokenConfig implements WebMvcConfigurer {
|
||||
registry.addInterceptor(new SaInterceptor(handle -> StpUtil.checkLogin()))
|
||||
.addPathPatterns("/**")
|
||||
.excludePathPatterns(
|
||||
"/auth/login",
|
||||
"/auth/register",
|
||||
"/auth/feishu/authorize",
|
||||
"/auth/feishu/login",
|
||||
"/api/v1/auth/login",
|
||||
"/api/v1/auth/register",
|
||||
"/api/v1/auth/feishu/login",
|
||||
"/error",
|
||||
"/swagger-ui/**",
|
||||
"/v3/api-docs/**"
|
||||
|
||||
@@ -23,20 +23,6 @@ public class FeishuAuthController {
|
||||
|
||||
private final FeishuAuthService feishuAuthService;
|
||||
|
||||
/**
|
||||
* 获取飞书OAuth授权URL
|
||||
*
|
||||
* @param state 可选的状态参数(防CSRF攻击)
|
||||
* @return 授权URL
|
||||
*/
|
||||
@GetMapping("/authorize")
|
||||
public BaseResponse<Map<String, String>> getAuthUrl(@RequestParam(required = false) String state) {
|
||||
String authUrl = feishuAuthService.buildAuthUrl(state);
|
||||
Map<String, String> result = new HashMap<>();
|
||||
result.put("authUrl", authUrl);
|
||||
return ResultUtils.success("获取授权URL成功",result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 飞书OAuth登录接口(前端回调后调用)
|
||||
* 前端从飞书回调中获取code,然后调用此接口完成登录
|
||||
|
||||
Reference in New Issue
Block a user