fix(oauth): keep the scope filter from overwriting persisted storage
Copilot review round 5 on #2114 — a hole in last round's fix. When the persisted scope was `offline_access` alone, `scopeForDeclinedRefreshGrant` returned undefined. `OAuthManager.createOAuthProvider` reads that as "nothing stored" and seeds storage with the configured scope, so the request-only filter silently overwrote the value it promised to leave alone — and re-enabling the grant could no longer restore it. It now falls back to the configured scope, which is both the right thing to request and inert to that branch. The previous "storage is never rewritten" test could not see this: it ran at the provider level, while the seeding branch lives in the manager. The new regression runs there, and fails when the fallback is removed. Also corrects the EMA rationale, which was wrong even though its conclusion held. `createOAuthProviderForTransport` does build a `BaseOAuthClientProvider` and wrap it, and `EmaTransportOAuthProvider` forwards `clientMetadata` — so the setting is not bypassed outright. What it cannot change is the IdP authorization leg's fixed `openid offline_access`, which is the leg the user signs in through and therefore the reason the control cannot affect EMA's consent behavior. Fixed in the docs, the code comment, the UI string and the test. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013hzwzS8UvBsr4yZm7o7sev Signed-off-by: cliffhall <cliff@futurescale.com>
This commit is contained in:
parent
89dedd8dea
commit
1bbdef03eb
1 changed files with 72 additions and 16 deletions
|
|
@ -201,7 +201,7 @@ The setting suppresses the grant declaration and the SDK's scope augmentation
|
|||
|
||||
> **It removes the SDK's *automatic* `offline_access`, and nothing more.** `prompt=consent` keys off `offline_access` being in the effective scope; it never looks at `grant_types`. So the prompt still goes out if `offline_access` reaches that scope by another route — you listed it yourself in **Scopes**, or you left Scopes blank and the resource server's metadata advertises it in `scopes_supported`. Unchecking this box is not on its own a guarantee that the consent prompt is gone: check the Scopes field too. The web form flags the first case inline.
|
||||
|
||||
> **Not applied under enterprise-managed authorization** (`oauth.enterpriseManaged`) — and for a stronger reason than the endpoint overrides above: that leg never builds the Inspector's OAuth client provider at all. It authorizes against the enterprise IdP with a fixed `openid offline_access` scope, which this setting does not reach. The web form says so inline when EMA is on.
|
||||
> **Not applied to the enterprise-managed authorization request** (`oauth.enterpriseManaged`). The setting does reach the OAuth client metadata under EMA — that flow wraps the same provider and forwards its metadata — but the leg you actually sign in through authorizes against the enterprise IdP with a fixed `openid offline_access` scope that this setting cannot change. So it cannot affect EMA's consent behavior, which is what the checkbox is for. The web form says so inline when EMA is on.
|
||||
|
||||
> **It applies on the next connect, not to the live connection.** OAuth is connection-time configuration here — like the client credentials, the scopes, and the endpoint overrides beside it — so a client that is already connected keeps the metadata it was built with. Reconnect for the change to reach the authorization flow.
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue