Add device-code authorization for gateway OAuth (#59822)

## Why

Gateway sign-in needs an alternative for terminals that cannot open a browser.

## What changed

- Add optional `gateway_oauth.device_authorization_url` configuration and a `login_with_device_code` API that presents a verification URL and user code, polls for approval, and persists the resulting credentials.
- Use the configured proxy and network policy, validate verification URLs, and bound OAuth responses. Support cancellation and report denied or expired codes without exposing issuer error details.

## Testing

Add tests for successful authorization and credential persistence, unsafe verification URLs, network-policy denials, denied and expired codes, and cancellation during approval or credential storage.

GitOrigin-RevId: 96398578fb866d34929e85c04eadf468d8cd3255
This commit is contained in:
smurching-oai
2026-11-06 04:24:04 +00:00
committed by copyberry
parent aece559654
commit df38cb3b2a
22 changed files with 568 additions and 8 deletions
+1
View File
@@ -84,6 +84,7 @@ pub use crate::transport::ByteStream;
pub use crate::transport::HttpTransport;
pub use crate::transport::ReqwestTransport;
pub use crate::transport::StreamResponse;
pub use crate::transport::bounded_response_bytes;
#[cfg(windows)]
mod windows_proxy_auth;
+1 -1
View File
@@ -297,7 +297,7 @@ fn bounded_response_stream(
Ok(Box::pin(stream))
}
async fn bounded_response_bytes(
pub async fn bounded_response_bytes(
response: HttpResponse,
max_bytes: usize,
) -> Result<Bytes, TransportError> {