TestScope_AgentKeyPinnedToBoundAgent: a per-agent runtime route lets an agent-scoped credential act as its bound agent but 403s on any other agent; an account-scoped credential reaches both.
(t *testing.T)
| 165 | // agent-scoped credential act as its bound agent but 403s on any other agent; |
| 166 | // an account-scoped credential reaches both. |
| 167 | func TestScope_AgentKeyPinnedToBoundAgent(t *testing.T) { |
| 168 | srv := scopeTestServer(t) |
| 169 | |
| 170 | cases := []struct { |
| 171 | name, path, bearer string |
| 172 | wantStatus int |
| 173 | }{ |
| 174 | {"bound-agent-ok", "/v1/agents/support%40acme.com", "agtSupport", 200}, |
| 175 | {"other-agent-403", "/v1/agents/other%40acme.com", "agtSupport", 403}, |
| 176 | {"account-reaches-support", "/v1/agents/support%40acme.com", "acct", 200}, |
| 177 | {"account-reaches-other", "/v1/agents/other%40acme.com", "acct", 200}, |
| 178 | } |
| 179 | for _, c := range cases { |
| 180 | t.Run(c.name, func(t *testing.T) { |
| 181 | code, body := sendJSON(t, "GET", srv.URL+c.path, c.bearer, nil) |
| 182 | if code != c.wantStatus { |
| 183 | t.Fatalf("GET %s as %s: status %d, want %d (body %v)", c.path, c.bearer, code, c.wantStatus, body) |
| 184 | } |
| 185 | }) |
| 186 | } |
| 187 | } |
| 188 | |
| 189 | // TestScope_LegacyAuthenticatorIsAccount: with only the legacy Authenticator |
| 190 | // wired (no PrincipalAuthenticator), every caller is treated as account-scoped |
nothing calls this directly
no test coverage detected