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:
@@ -22,7 +22,7 @@ Use cases:
|
||||
|
||||
## Features
|
||||
|
||||
- Four independent string values, each with a setter and a getter: actor (`towel.WithActor`, `towel.Actor`), organization (`towel.WithOrganization`, `towel.Organization`), collection (`towel.WithCollection`, `towel.Collection`) and locale (`towel.WithLocale`, `towel.Locale`).
|
||||
- Five independent string values, each with a setter and a getter: actor (`towel.WithActor`, `towel.Actor`), organization (`towel.WithOrganization`, `towel.Organization`), collection (`towel.WithCollection`, `towel.Collection`), locale (`towel.WithLocale`, `towel.Locale`) and client address (`towel.WithClientIP`, `towel.ClientIP`).
|
||||
- Unexported context key types, so no other package can read or overwrite the values by accident.
|
||||
- Getters return `(value, ok)`: a value that was set to an empty string is distinguishable from one that was never set.
|
||||
- Nil-safe: a setter given a nil context starts from `context.Background()`, and a getter given a nil context reports `false`.
|
||||
@@ -66,6 +66,7 @@ func listPosts(w http.ResponseWriter, r *http.Request) {
|
||||
| `towel.WithOrganization` / `towel.Organization` | Store and read the organization (tenant) the request belongs to. |
|
||||
| `towel.WithCollection` / `towel.Collection` | Store and read the collection the request operates on. |
|
||||
| `towel.WithLocale` / `towel.Locale` | Store and read the locale used for translations and localized responses. |
|
||||
| `towel.WithClientIP` / `towel.ClientIP` | Store and read the request's client address for code below the HTTP layer, such as a token resolver logging a failed attempt. |
|
||||
|
||||
## Dependencies
|
||||
|
||||
|
||||
Reference in New Issue
Block a user