fix(pier): end only the revoked token's or client's MCP sessions and log the client address (B-WR-04, B-IN-04)

- pact.MCPSubjectChanged and pier.Event gain TokenID and ClientID; a
  narrowed revoked event closes only matching sessions and stateless servers
- cabana fires the admin token revoke with the token row id
- towel.WithClientIP/ClientIP; pier puts the address (surf applies
  http.trusted_proxies) on the resolve context and ResolveBackendToken logs it
This commit is contained in:
Jakub Zych
2026-10-23 16:21:37 +02:00
parent 0ec00f7f69
commit 24cf6cd931
16 changed files with 158 additions and 31 deletions

View File

@@ -18,6 +18,14 @@ type Host interface {
Owner(method, path string) (string, bool)
}
// clientIPHost is optional for a Host: a host that knows the application's
// trusted proxies answers the client address of a request, which pier puts
// on the token resolvers' context (towel.WithClientIP). Without it pier uses
// the host part of the request's RemoteAddr.
type clientIPHost interface {
ClientIP(*http.Request) string
}
// RouteInfo is one registered route as the Host reports it: the HTTP method,
// the pattern as registered (with {param} segments), the plugin that
// registered it and its middleware names in order.