You've already forked agentic-coding-workflow
bugfix
This commit is contained in:
@@ -5,6 +5,8 @@ import (
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/google/uuid"
|
||||
|
||||
"github.com/yan1h/agent-coding-workflow/internal/infra/errs"
|
||||
httpx "github.com/yan1h/agent-coding-workflow/internal/transport/http"
|
||||
"github.com/yan1h/agent-coding-workflow/internal/transport/http/middleware"
|
||||
@@ -23,6 +25,9 @@ type AuthSession struct {
|
||||
UserID string // user_id 字符串形式(避免反复 uuid.UUID -> string 转换)
|
||||
Scope Scope
|
||||
Issuer Issuer // system token(agent 会话持有)受额外限制,见 create_acp_session
|
||||
// ACPSessionID 仅 system token 非 nil:标识持有该 token 的 agent 所在 acp session。
|
||||
// request_subtask 据此把调用方映射回其编排 step。
|
||||
ACPSessionID *uuid.UUID
|
||||
}
|
||||
|
||||
// FromContext 从 ctx 取出 AuthSession,未鉴权时返 (nil, false)。
|
||||
@@ -51,10 +56,11 @@ func NewAuthMiddleware(svc TokenService) func(http.Handler) http.Handler {
|
||||
return
|
||||
}
|
||||
sess := &AuthSession{
|
||||
TokenID: tok.ID.String(),
|
||||
UserID: tok.UserID.String(),
|
||||
Scope: tok.Scope,
|
||||
Issuer: tok.Issuer,
|
||||
TokenID: tok.ID.String(),
|
||||
UserID: tok.UserID.String(),
|
||||
Scope: tok.Scope,
|
||||
Issuer: tok.Issuer,
|
||||
ACPSessionID: tok.ACPSessionID,
|
||||
}
|
||||
ctx := context.WithValue(r.Context(), AuthContextKey, sess)
|
||||
next.ServeHTTP(w, r.WithContext(ctx))
|
||||
|
||||
Reference in New Issue
Block a user