(
&self,
_request: Request<Streaming<HandshakeRequest>>,
)
| 216 | type FlightService = FlightSqlServiceImpl; |
| 217 | |
| 218 | async fn do_handshake( |
| 219 | &self, |
| 220 | _request: Request<Streaming<HandshakeRequest>>, |
| 221 | ) -> Result< |
| 222 | Response<Pin<Box<dyn Stream<Item = Result<HandshakeResponse, Status>> + Send>>>, |
| 223 | Status, |
| 224 | > { |
| 225 | info!("do_handshake"); |
| 226 | // no authentication actually takes place here |
| 227 | // see Ballista implementation for example of basic auth |
| 228 | // in this case, we simply accept the connection and create a new SessionContext |
| 229 | // the SessionContext will be re-used within this same connection/session |
| 230 | let token = self.create_ctx().await?; |
| 231 | |
| 232 | let result = HandshakeResponse { |
| 233 | protocol_version: 0, |
| 234 | payload: token.as_bytes().to_vec().into(), |
| 235 | }; |
| 236 | let result = Ok(result); |
| 237 | let output = futures::stream::iter(vec![result]); |
| 238 | let str = format!("Bearer {token}"); |
| 239 | let mut resp: Response<Pin<Box<dyn Stream<Item = Result<_, _>> + Send>>> = |
| 240 | Response::new(Box::pin(output)); |
| 241 | let md = MetadataValue::try_from(str) |
| 242 | .map_err(|_| Status::invalid_argument("authorization not parsable"))?; |
| 243 | resp.metadata_mut().insert("authorization", md); |
| 244 | Ok(resp) |
| 245 | } |
| 246 | |
| 247 | async fn do_get_fallback( |
| 248 | &self, |
nothing calls this directly
no test coverage detected