go-todo-api/services/auth_service.go
2025-12-02 18:58:25 +08:00

18 lines
564 B
Go
Raw Permalink 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.

// services/auth_service.go
package services
import (
"go-todo-api/dto"
"go-todo-api/models"
)
// AuthService 定义了用户认证和授权相关的业务逻辑
type AuthService interface {
// Register 处理用户注册,返回创建的用户和可能的错误
Register(input *dto.RegisterInput) (*models.User, error)
// Login 处理用户登录,返回 JWT 令牌和可能的错误
Login(input *dto.LoginInput) (string, error)
// AuthenticateToken 验证 JWT 令牌返回用户ID (Subject)
AuthenticateToken(tokenString string) (string, error)
}