fix: harden API principal config after review

Add require_direct_header toggle, external user ID validation, JWT TTL
limits, SaveToken error handling, ru-RU i18n, API docs, and Go SDK methods.
This commit is contained in:
wizardchen
2026-06-30 10:54:00 +08:00
committed by lyingbug
parent cb99736d72
commit 97bca74a31
17 changed files with 1212 additions and 14 deletions
+2 -1
View File
@@ -3,6 +3,7 @@ package repository
import (
"context"
"errors"
"fmt"
"time"
"github.com/Tencent/WeKnora/internal/types"
@@ -95,7 +96,7 @@ func (r *mcpOAuthRepository) SaveToken(ctx context.Context, token *types.MCPOAut
func (r *mcpOAuthRepository) SaveTokenForPrincipal(ctx context.Context, token *types.MCPOAuthToken) error {
if token.PrincipalType == "" || token.PrincipalID == "" {
return nil
return fmt.Errorf("mcp oauth token requires principal_type and principal_id")
}
if token.UserID == "" {
token.UserID = (types.Principal{Type: token.PrincipalType, ID: token.PrincipalID}).StorageID()