This commit is contained in:
Windfarer
2026-03-30 11:13:44 +08:00
parent 72dfb9ce75
commit c1816fe6d6
54 changed files with 3412 additions and 807 deletions
+1
View File
@@ -71,6 +71,7 @@ type StreamResponse struct {
ToolCalls []LLMToolCall `json:"tool_calls,omitempty"`
Data map[string]interface{} `json:"data,omitempty"`
Usage *TokenUsage `json:"usage,omitempty"`
FinishReason string `json:"finish_reason,omitempty"`
}
// References references
+4
View File
@@ -12,6 +12,10 @@ type UserService interface {
Register(ctx context.Context, req *types.RegisterRequest) (*types.User, error)
// Login authenticates a user and returns tokens
Login(ctx context.Context, req *types.LoginRequest) (*types.LoginResponse, error)
// GetOIDCAuthorizationURL builds the third-party OIDC authorization URL
GetOIDCAuthorizationURL(ctx context.Context, redirectURI string) (*types.OIDCAuthURLResponse, error)
// LoginWithOIDC exchanges the callback code, auto-provisions users if needed, and completes login
LoginWithOIDC(ctx context.Context, code, redirectURI string) (*types.OIDCCallbackResponse, error)
// GetUserByID gets a user by ID
GetUserByID(ctx context.Context, id string) (*types.User, error)
// GetUserByEmail gets a user by email
+30
View File
@@ -64,6 +64,36 @@ type LoginRequest struct {
Password string `json:"password" binding:"required,min=6"`
}
type OIDCAuthURLResponse struct {
Success bool `json:"success"`
ProviderDisplayName string `json:"provider_display_name,omitempty"`
AuthorizationURL string `json:"authorization_url,omitempty"`
State string `json:"state,omitempty"`
}
type OIDCConfigResponse struct {
Success bool `json:"success"`
Enabled bool `json:"enabled"`
ProviderDisplayName string `json:"provider_display_name,omitempty"`
}
type OIDCCallbackResponse struct {
Success bool `json:"success"`
Message string `json:"message,omitempty"`
User *User `json:"user,omitempty"`
Tenant *Tenant `json:"tenant,omitempty"`
Token string `json:"token,omitempty"`
RefreshToken string `json:"refresh_token,omitempty"`
IsNewUser bool `json:"is_new_user,omitempty"`
}
type OIDCUserInfo struct {
Subject string `json:"subject,omitempty"`
Username string `json:"username,omitempty"`
Email string `json:"email,omitempty"`
Claims map[string]interface{} `json:"claims,omitempty"`
}
// RegisterRequest represents a registration request
type RegisterRequest struct {
Username string `json:"username" binding:"required,min=2,max=50"`