Allow provider selection for gateway OAuth reads and logins (#59819)

## Why

Gateway OAuth reads and logins previously used only the current provider, preventing clients from authorizing another configured provider without changing the default.

## What changed

- Add optional `modelProvider` params to `account/gatewayOAuth/read` and `account/gatewayOAuth/login`, preserving current-provider behavior for omitted or null params and selectors.
- Validate explicit providers against current managed policy without changing the default or any thread's provider.
- Retain readiness state across providers and send `account/gatewayOAuth/changed` notifications for every configured provider sharing the changed credential.
- Update protocol schemas, TypeScript types, Python models, and documentation.

## Testing

Add coverage for non-default provider login, retained readiness when alternating providers, notifications for shared credentials without starting login, and legacy TypeScript request compatibility.

GitOrigin-RevId: cfd472c322b821fe36b8c133a8de774f4ba48534
This commit is contained in:
Abhinav
2026-11-06 04:02:11 +00:00
committed by copyberry
parent a142c90e26
commit aece559654
22 changed files with 561 additions and 71 deletions
+12 -10
View File
@@ -1890,12 +1890,13 @@ impl MessageProcessor {
.bedrock_check_gov_cloud_requirements()
.await
}
ClientRequest::GatewayOAuthRead { .. } => {
Box::pin(self.account_processor.gateway_oauth_read())
.await
.map(|response| Some(response.into()))
}
ClientRequest::GatewayOAuthLogin { .. } => {
ClientRequest::GatewayOAuthRead { params, .. } => Box::pin(
self.account_processor
.gateway_oauth_read(params.unwrap_or_default()),
)
.await
.map(|response| Some(response.into())),
ClientRequest::GatewayOAuthLogin { params, .. } => {
if session
.opted_out_notification_methods()
.contains("account/gatewayOAuth/changed")
@@ -1904,10 +1905,11 @@ impl MessageProcessor {
"Gateway login requires account/gatewayOAuth/changed notifications",
))
} else {
Box::pin(
self.account_processor
.gateway_oauth_login(connection_id, &session.rpc_gate),
)
Box::pin(self.account_processor.gateway_oauth_login(
params.unwrap_or_default(),
connection_id,
&session.rpc_gate,
))
.await
.map(|response| Some(response.into()))
}