Merge pull request #34252 from backstage/freben/lazy-permission-user

permission: cache user info, clean up PolicyQueryUser, drop getPluginRequestToken
This commit is contained in:
Fredrik Adelöw
2026-05-19 15:20:48 +02:00
committed by GitHub
12 changed files with 311 additions and 51 deletions
@@ -0,0 +1,5 @@
---
'@backstage/plugin-permission-backend': patch
---
The permission backend no longer populates the removed `token` and `identity` fields on `PolicyQueryUser`, and no longer calls `auth.getPluginRequestToken()` during policy evaluation. This removes one internal round-trip per authorize request.
@@ -0,0 +1,11 @@
---
'@backstage/plugin-permission-node': minor
---
**BREAKING**: Cleaned up the `PolicyQueryUser` type:
- `token`**Removed.** Was previously deprecated in favor of `credentials` with `coreServices.auth`.
- `expiresInSeconds`**Removed.** Was previously deprecated.
- `identity`**Removed.** Was previously deprecated in favor of `info`.
- `info`**Deprecated.** Still required and populated for now; will be made optional and then removed in a future release.
- `credentials` — Unchanged.
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/backend-defaults': patch
---
Added a new `CachedUserInfoService` decorator that wraps `DefaultUserInfoService` with a 5-second TTL cache and in-flight request coalescing. The decorator is wired in via `userInfoServiceFactory` using a shared root-level cache. Repeated `getUserInfo()` calls for the same user token within the TTL window return the cached result without making an HTTP call to the auth backend. Note that custom `UserInfoService` implementations registered via their own factory will not benefit from this cache automatically.