feat: scope API MCP OAuth by principal

This commit is contained in:
wizardchen
2026-06-30 09:21:49 +08:00
committed by lyingbug
parent 77e4f93e3e
commit cb99736d72
39 changed files with 1566 additions and 108 deletions
+8 -6
View File
@@ -9,6 +9,7 @@ import (
"sync"
"time"
"github.com/Tencent/WeKnora/internal/types"
"github.com/redis/go-redis/v9"
)
@@ -22,12 +23,13 @@ const oauthStateTTL = 10 * time.Minute
// authorization server — hence server-side storage rather than encoding it
// into the state parameter.
type OAuthState struct {
TenantID uint64 `json:"tenant_id"`
UserID string `json:"user_id"`
ServiceID string `json:"service_id"`
CodeVerifier string `json:"code_verifier"`
ClientID string `json:"client_id"`
RedirectURI string `json:"redirect_uri"`
TenantID uint64 `json:"tenant_id"`
UserID string `json:"user_id"`
Principal types.Principal `json:"principal"`
ServiceID string `json:"service_id"`
CodeVerifier string `json:"code_verifier"`
ClientID string `json:"client_id"`
RedirectURI string `json:"redirect_uri"`
// FrontendRedirect is where the backend callback redirects the browser
// after completing (or failing) the exchange.
FrontendRedirect string `json:"frontend_redirect"`