test: TestJournalPromptWrites grants record the consented administrator
pier now gives a backend subject only to a grant whose consented administrator (pact.MCPGrant.BackendUserID) is the one linked; the fake verifier's grants name the linked backend user.
This commit is contained in:
@@ -43,7 +43,8 @@ func (h *servingHost) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
// promptGrants verifies two OAuth grants of one linked user: read only and
|
||||
// read+write, both with the backend scope.
|
||||
// read+write, both with the backend scope and consented for the linked
|
||||
// backend user 1 (pact.MCPGrant.BackendUserID).
|
||||
type promptGrants struct{}
|
||||
|
||||
func (promptGrants) MCPVerifyToken(_ context.Context, raw string) (pact.MCPGrant, error) {
|
||||
@@ -51,7 +52,7 @@ func (promptGrants) MCPVerifyToken(_ context.Context, raw string) (pact.MCPGrant
|
||||
if scopes == nil {
|
||||
return pact.MCPGrant{}, pact.ErrMCPTokenInvalid
|
||||
}
|
||||
return pact.MCPGrant{UserID: 5, ClientID: "agent", TokenID: 9, Scopes: scopes, ExpiresAt: time.Now().Add(time.Hour)}, nil
|
||||
return pact.MCPGrant{UserID: 5, ClientID: "agent", TokenID: 9, Scopes: scopes, ExpiresAt: time.Now().Add(time.Hour), BackendUserID: 1}, nil
|
||||
}
|
||||
|
||||
func (promptGrants) MCPResource() string { return "https://app.example.test/mcp" }
|
||||
|
||||
Reference in New Issue
Block a user