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
+4 -2
View File
@@ -65,7 +65,8 @@ func oauthSessionForRegistration(ctx context.Context, sess *MCPOAuthSession, ret
}
userID := sess.UserID
if userID == "" {
userID, _ = types.UserIDFromContext(ctx)
principal, _ := types.PrincipalFromContext(ctx)
userID = principal.StorageID()
}
requestID := sess.RequestID
if requestID == "" {
@@ -141,7 +142,8 @@ func waitForMCPOAuthAuthorization(
tenantID, _ := types.TenantIDFromContext(ctx)
userID := sess.UserID
if userID == "" {
userID, _ = types.UserIDFromContext(ctx)
principal, _ := types.PrincipalFromContext(ctx)
userID = principal.StorageID()
}
requestID := sess.RequestID
if requestID == "" {