Build a gRPC [`OpenShellClient`]. When `tls.edge_token` is set, the returned client is wrapped with an interceptor that injects authentication headers on every request. Otherwise, standard mTLS is used (interceptor is a no-op).
(server: &str, tls: &TlsOptions)
| 435 | /// interceptor that injects authentication headers on every request. |
| 436 | /// Otherwise, standard mTLS is used (interceptor is a no-op). |
| 437 | pub async fn grpc_client(server: &str, tls: &TlsOptions) -> Result<GrpcClient> { |
| 438 | let channel = build_channel(server, tls).await?; |
| 439 | let interceptor = interceptor_from_tls(tls)?; |
| 440 | Ok(OpenShellClient::with_interceptor(channel, interceptor)) |
| 441 | } |
| 442 | |
| 443 | fn interceptor_from_tls(tls: &TlsOptions) -> Result<EdgeAuthInterceptor> { |
| 444 | EdgeAuthInterceptor::new(tls.oidc_token.as_deref(), tls.edge_token.as_deref()) |