feat(embed): scope OAuth and sessions per visitor principal
Add embed visitor principals (X-Embed-Visitor), widen sessions.user_id, embed MCP OAuth/approval routes, OAuth callback context detachment, and CloneContext principal preservation for async QA streams.
This commit is contained in:
@@ -116,9 +116,10 @@ func (h *Handler) CreateSession(c *gin.Context) {
|
||||
Description: request.Description,
|
||||
}
|
||||
// Attach the calling user as the session owner when available.
|
||||
// API-key / legacy callers without a user id fall back to tenant-level visibility.
|
||||
if userID, ok := types.UserIDFromContext(ctx); ok {
|
||||
createdSession.UserID = userID
|
||||
// API-key callers scope sessions per external user when configured;
|
||||
// otherwise they fall back to the synthetic tenant user.
|
||||
if ownerID := types.SessionOwnerIDFromContext(ctx); ownerID != "" {
|
||||
createdSession.UserID = ownerID
|
||||
}
|
||||
|
||||
// Call service to create session
|
||||
|
||||
Reference in New Issue
Block a user