mirror of
https://gitee.com/mateos/mateclaw.git
synced 2026-09-13 11:13:43 +08:00
Full-stack AI assistant built on Spring AI Alibaba. Features: ReAct Agent, Plan-and-Execute, MCP Protocol, Multi-Model, Multi-Channel. Apache-2.0 License
56 lines
1.5 KiB
Java
56 lines
1.5 KiB
Java
package vip.mate.auth.controller;
|
|
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
import lombok.RequiredArgsConstructor;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import vip.mate.auth.model.LoginRequest;
|
|
import vip.mate.auth.model.LoginResponse;
|
|
import vip.mate.auth.model.UserEntity;
|
|
import vip.mate.auth.service.AuthService;
|
|
import vip.mate.common.result.R;
|
|
|
|
import java.util.List;
|
|
|
|
/**
|
|
* 认证接口
|
|
*
|
|
* @author MateClaw Team
|
|
*/
|
|
@Tag(name = "认证管理")
|
|
@RestController
|
|
@RequestMapping("/api/v1/auth")
|
|
@RequiredArgsConstructor
|
|
public class AuthController {
|
|
|
|
private final AuthService authService;
|
|
|
|
@Operation(summary = "用户登录")
|
|
@PostMapping("/login")
|
|
public R<LoginResponse> login(@RequestBody LoginRequest request) {
|
|
return R.ok(authService.login(request));
|
|
}
|
|
|
|
@Operation(summary = "获取用户列表")
|
|
@GetMapping("/users")
|
|
public R<List<UserEntity>> listUsers() {
|
|
return R.ok(authService.listUsers());
|
|
}
|
|
|
|
@Operation(summary = "创建用户")
|
|
@PostMapping("/users")
|
|
public R<UserEntity> createUser(@RequestBody UserEntity user) {
|
|
return R.ok(authService.createUser(user));
|
|
}
|
|
|
|
@Operation(summary = "修改密码")
|
|
@PutMapping("/users/{id}/password")
|
|
public R<Void> changePassword(
|
|
@PathVariable Long id,
|
|
@RequestParam String oldPassword,
|
|
@RequestParam String newPassword) {
|
|
authService.changePassword(id, oldPassword, newPassword);
|
|
return R.ok();
|
|
}
|
|
}
|