(req: HttpRequest)
| 28 | } |
| 29 | |
| 30 | async fn route_whoami(req: HttpRequest) -> impl Responder { |
| 31 | let conn_info = req.conn_data::<ConnectionInfo>().unwrap(); |
| 32 | let client_cert = req.conn_data::<CertificateDer<'static>>(); |
| 33 | |
| 34 | if let Some(cert) = client_cert { |
| 35 | HttpResponse::Ok().body(format!("{:?}\n\n{:?}", conn_info, cert)) |
| 36 | } else { |
| 37 | HttpResponse::Unauthorized().body("No client certificate provided.") |
| 38 | } |
| 39 | } |
| 40 | |
| 41 | fn get_client_cert(connection: &dyn Any, data: &mut Extensions) { |
| 42 | if let Some(tls_socket) = connection.downcast_ref::<TlsStream<TcpStream>>() { |
nothing calls this directly
no outgoing calls
no test coverage detected