From 0e862404668d146b2911cd8c17460a0de352eef8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frank=20M=C3=A4rkle?= Date: Fri, 12 Jul 2024 14:12:23 +0200 Subject: [PATCH] WIP network stack upgrade --- Cargo.lock | 606 +++++++++++++----- Cargo.toml | 34 +- opendut-carl/opendut-carl-api/build.rs | 2 +- opendut-types/src/proto/peer/mod.rs | 2 +- opendut-util/opendut-auth/Cargo.toml | 6 +- .../opendut-auth-tests/src/lib.rs | 2 + .../src/confidential/blocking/client.rs | 10 +- .../confidential/blocking/reqwest_client.rs | 27 +- .../opendut-auth/src/confidential/client.rs | 16 +- .../opendut-auth/src/confidential/config.rs | 30 +- .../src/confidential/reqwest_client.rs | 26 +- .../src/confidential/tonic_service.rs | 11 +- .../opendut-auth/src/registration/client.rs | 3 +- 13 files changed, 542 insertions(+), 233 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3892e3e24..a708eb579 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -236,6 +236,12 @@ dependencies = [ "syn 2.0.87", ] +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + [[package]] name = "attribute-derive" version = "0.9.2" @@ -288,7 +294,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3b829e4e32b91e643de6eafe82b1d90675f5874230191a4ffbc1b336dec4d6bf" dependencies = [ "async-trait", - "axum-core", + "axum-core 0.3.4", "bitflags 1.3.2", "bytes", "futures-util", @@ -303,14 +309,44 @@ dependencies = [ "pin-project-lite", "rustversion", "serde", + "sync_wrapper 0.1.2", + "tower 0.4.13", + "tower-layer", + "tower-service", +] + +[[package]] +name = "axum" +version = "0.7.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edca88bc138befd0323b20752846e6587272d3b03b0343c8ea28a6f819e6e71f" +dependencies = [ + "async-trait", + "axum-core 0.4.5", + "bytes", + "futures-util", + "http 1.1.0", + "http-body 1.0.1", + "http-body-util", + "hyper 1.5.0", + "hyper-util", + "itoa", + "matchit", + "memchr", + "mime", + "percent-encoding", + "pin-project-lite", + "rustversion", + "serde", "serde_json", "serde_path_to_error", "serde_urlencoded", - "sync_wrapper", + "sync_wrapper 1.0.1", "tokio", - "tower", + "tower 0.5.1", "tower-layer", "tower-service", + "tracing", ] [[package]] @@ -330,41 +366,66 @@ dependencies = [ "tower-service", ] +[[package]] +name = "axum-core" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09f2bd6146b97ae3359fa0cc6d6b376d9539582c7b4220f041a33ec24c226199" +dependencies = [ + "async-trait", + "bytes", + "futures-util", + "http 1.1.0", + "http-body 1.0.1", + "http-body-util", + "mime", + "pin-project-lite", + "rustversion", + "sync_wrapper 1.0.1", + "tower-layer", + "tower-service", + "tracing", +] + [[package]] name = "axum-server" -version = "0.5.1" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "447f28c85900215cc1bea282f32d4a2f22d55c5a300afdfbc661c8d6a632e063" +checksum = "c1ad46c3ec4e12f4a4b6835e173ba21c25e484c9d02b49770bf006ce5367c036" dependencies = [ "arc-swap", "bytes", "futures-util", - "http 0.2.12", - "http-body 0.4.6", - "hyper 0.14.31", + "http 1.1.0", + "http-body 1.0.1", + "http-body-util", + "hyper 1.5.0", + "hyper-util", "pin-project-lite", "rustls 0.21.12", - "rustls-pemfile 1.0.4", + "rustls-pemfile", "tokio", "tokio-rustls 0.24.1", + "tower 0.4.13", "tower-service", ] [[package]] name = "axum-server-dual-protocol" -version = "0.5.2" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d1a8f5076b5dbfeb706bcce30fe73caf20971e6e5ca80b83a7f1d990e73e185" +checksum = "7ea4cd08ae2a5f075d28fa31190163c8106a1d2d3189442494bae22b39040a0d" dependencies = [ "axum-server", "bytes", - "http 0.2.12", - "hyper 0.14.31", + "http 1.1.0", + "http-body-util", "pin-project", "tokio", "tokio-rustls 0.24.1", "tokio-util", "tower-layer", + "tower-service", ] [[package]] @@ -460,14 +521,14 @@ dependencies = [ "http-body-util", "hyper 1.5.0", "hyper-named-pipe", - "hyper-rustls 0.27.3", + "hyper-rustls", "hyper-util", "hyperlocal", "log", "pin-project-lite", "rustls 0.23.17", "rustls-native-certs 0.7.3", - "rustls-pemfile 2.2.0", + "rustls-pemfile", "rustls-pki-types", "serde", "serde_derive", @@ -2145,6 +2206,25 @@ dependencies = [ "tracing", ] +[[package]] +name = "h2" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "524e8ac6999421f49a846c2d4411f337e53497d8ec55d67753beffa43c5d9205" +dependencies = [ + "atomic-waker", + "bytes", + "fnv", + "futures-core", + "futures-sink", + "http 1.1.0", + "indexmap 2.6.0", + "slab", + "tokio", + "tokio-util", + "tracing", +] + [[package]] name = "half" version = "2.4.1" @@ -2302,9 +2382,9 @@ dependencies = [ [[package]] name = "http-range-header" -version = "0.3.1" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "add0ab9360ddbd88cfeb3bd9574a1d85cfdfa14db10b3e21d3700dbc4328758f" +checksum = "08a397c49fec283e3d6211adbe480be95aae5f304cfb923e9970e08956d5168a" [[package]] name = "httparse" @@ -2328,7 +2408,7 @@ dependencies = [ "futures-channel", "futures-core", "futures-util", - "h2", + "h2 0.3.26", "http 0.2.12", "http-body 0.4.6", "httparse", @@ -2351,6 +2431,7 @@ dependencies = [ "bytes", "futures-channel", "futures-util", + "h2 0.4.6", "http 1.1.0", "http-body 1.0.1", "httparse", @@ -2377,20 +2458,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "hyper-rustls" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" -dependencies = [ - "futures-util", - "http 0.2.12", - "hyper 0.14.31", - "rustls 0.21.12", - "tokio", - "tokio-rustls 0.24.1", -] - [[package]] name = "hyper-rustls" version = "0.27.3" @@ -2402,6 +2469,7 @@ dependencies = [ "hyper 1.5.0", "hyper-util", "rustls 0.23.17", + "rustls-native-certs 0.8.0", "rustls-pki-types", "tokio", "tokio-rustls 0.26.0", @@ -2420,6 +2488,19 @@ dependencies = [ "tokio-io-timeout", ] +[[package]] +name = "hyper-timeout" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b90d566bffbce6a75bd8b09a05aa8c2cb1fabb6cb348f8840c9e4c90a0d83b0" +dependencies = [ + "hyper 1.5.0", + "hyper-util", + "pin-project-lite", + "tokio", + "tower-service", +] + [[package]] name = "hyper-util" version = "0.1.10" @@ -2770,6 +2851,15 @@ dependencies = [ "either", ] +[[package]] +name = "itertools" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "1.0.11" @@ -2997,7 +3087,7 @@ dependencies = [ "jwt", "leptos", "leptos_router", - "reqwest", + "reqwest 0.11.27", "serde", "serde_json", "thiserror 1.0.69", @@ -3564,16 +3654,16 @@ checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" [[package]] name = "oauth2" -version = "4.4.2" +version = "5.0.0-rc.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c38841cdd844847e3e7c8d29cef9dcfed8877f8f56f9071f77843ecf3baf937f" +checksum = "23d385da3c602d29036d2f70beed71c36604df7570be17fed4c5b839616785bf" dependencies = [ - "base64 0.13.1", + "base64 0.22.1", "chrono", "getrandom", - "http 0.2.12", + "http 1.1.0", "rand", - "reqwest", + "reqwest 0.12.9", "serde", "serde_json", "serde_path_to_error", @@ -3620,14 +3710,14 @@ dependencies = [ "chrono", "config 0.14.0", "googletest", - "http 0.2.12", + "http 1.1.0", "leptos_oidc", "oauth2", "opendut-types", "opendut-util-core", "openidconnect", "pem", - "reqwest", + "reqwest 0.12.9", "rstest", "serde", "serde_json", @@ -3635,8 +3725,8 @@ dependencies = [ "test-with", "thiserror 2.0.3", "tokio", - "tonic", - "tower", + "tonic 0.12.3", + "tower 0.4.13", "tracing", "url", ] @@ -3647,7 +3737,7 @@ version = "0.4.0-alpha" dependencies = [ "anyhow", "googletest", - "http 0.2.12", + "http 1.1.0", "oauth2", "opendut-auth", "opendut-types", @@ -3668,7 +3758,7 @@ version = "0.4.0-alpha" dependencies = [ "anyhow", "assert_fs", - "axum", + "axum 0.7.9", "axum-server", "axum-server-dual-protocol", "backon", @@ -3680,7 +3770,7 @@ dependencies = [ "flate2", "futures", "googletest", - "http 0.2.12", + "http 1.1.0", "indoc", "jsonwebtoken", "opendut-auth", @@ -3697,7 +3787,7 @@ dependencies = [ "pem", "pq-sys", "predicates", - "reqwest", + "reqwest 0.12.9", "rstest", "serde", "serde_json", @@ -3709,10 +3799,10 @@ dependencies = [ "thiserror 2.0.3", "tokio", "tokio-stream", - "tonic", + "tonic 0.12.3", "tonic-async-interceptor", "tonic-web", - "tower", + "tower 0.4.13", "tower-http", "tracing", "tracing-opentelemetry", @@ -3728,21 +3818,21 @@ dependencies = [ "config 0.14.0", "glob", "googletest", - "http 0.2.12", + "http 1.1.0", "jsonwebtoken", "leptos", "opendut-auth", "opendut-types", - "prost", + "prost 0.13.3", "protobuf-src", "rstest", "shadow-rs", "thiserror 2.0.3", "tokio", - "tonic", + "tonic 0.12.3", "tonic-build", "tonic-web-wasm-client", - "tower", + "tower 0.4.13", "tracing", "url", ] @@ -3761,7 +3851,7 @@ dependencies = [ "fs_extra", "lazy_static", "predicates", - "reqwest", + "reqwest 0.12.9", "serde-spdx", "serde_json", "shadow-rs", @@ -3832,7 +3922,7 @@ dependencies = [ "ping-rs", "predicates", "regex", - "reqwest", + "reqwest 0.12.9", "rstest", "rtnetlink", "serde", @@ -3843,7 +3933,7 @@ dependencies = [ "thiserror 2.0.3", "tokio", "toml_edit", - "tonic", + "tonic 0.12.3", "tracing", "tracing-opentelemetry", "url", @@ -3912,7 +4002,7 @@ dependencies = [ "slotmap", "strum", "thiserror 2.0.3", - "tonic", + "tonic 0.12.3", "tonic-web-wasm-client", "tracing", "tracing-subscriber", @@ -3930,15 +4020,15 @@ dependencies = [ "cargo_metadata", "opendut-types", "opendut-util", - "prost", + "prost 0.13.3", "prost-types", "protobuf-src", - "reqwest", + "reqwest 0.12.9", "thiserror 2.0.3", "tokio", - "tonic", + "tonic 0.12.3", "tonic-build", - "tower", + "tower 0.4.13", "tracing", "url", ] @@ -3971,7 +4061,7 @@ dependencies = [ "glob", "googletest", "pem", - "prost", + "prost 0.13.3", "prost-build", "protobuf-src", "serde", @@ -4002,7 +4092,7 @@ dependencies = [ "sysinfo", "thiserror 2.0.3", "tokio", - "tonic", + "tonic 0.12.3", "tracing", "tracing-opentelemetry", "tracing-subscriber", @@ -4033,12 +4123,12 @@ dependencies = [ "anyhow", "async-trait", "googletest", - "http 0.2.12", + "http 1.1.0", "mockall", "opendut-types", "opendut-util", "opendut-vpn", - "reqwest", + "reqwest 0.12.9", "reqwest-middleware", "reqwest-retry", "rstest", @@ -4055,16 +4145,16 @@ dependencies = [ [[package]] name = "openidconnect" -version = "3.5.0" +version = "4.0.0-rc.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f47e80a9cfae4462dd29c41e987edd228971d6565553fbc14b8a11e666d91590" +checksum = "a93a50789d0b649986bfb104cdef97736ca072d579ec88496d5c6f9abed0ea85" dependencies = [ - "base64 0.13.1", + "base64 0.21.7", "chrono", "dyn-clone", "ed25519-dalek", "hmac", - "http 0.2.12", + "http 1.1.0", "itertools 0.10.5", "log", "oauth2", @@ -4074,7 +4164,6 @@ dependencies = [ "rsa", "serde", "serde-value", - "serde_derive", "serde_json", "serde_path_to_error", "serde_plain", @@ -4152,10 +4241,10 @@ dependencies = [ "opentelemetry", "opentelemetry-proto", "opentelemetry_sdk", - "prost", + "prost 0.12.6", "thiserror 1.0.69", "tokio", - "tonic", + "tonic 0.11.0", ] [[package]] @@ -4166,8 +4255,8 @@ checksum = "984806e6cf27f2b49282e2a05e288f30594f3dbc74eb7a6e99422bc48ed78162" dependencies = [ "opentelemetry", "opentelemetry_sdk", - "prost", - "tonic", + "prost 0.12.6", + "tonic 0.11.0", ] [[package]] @@ -4704,24 +4793,34 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "deb1435c188b76130da55f17a466d252ff7b1418b2ad3e037d127b94e3411f29" dependencies = [ "bytes", - "prost-derive", + "prost-derive 0.12.6", +] + +[[package]] +name = "prost" +version = "0.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b0487d90e047de87f984913713b85c601c05609aad5b0df4b4573fbf69aa13f" +dependencies = [ + "bytes", + "prost-derive 0.13.3", ] [[package]] name = "prost-build" -version = "0.12.6" +version = "0.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22505a5c94da8e3b7c2996394d1c933236c4d743e81a410bcca4e6989fc066a4" +checksum = "0c1318b19085f08681016926435853bbf7858f9c082d0999b80550ff5d9abe15" dependencies = [ "bytes", "heck", - "itertools 0.12.1", + "itertools 0.13.0", "log", "multimap", "once_cell", "petgraph", "prettyplease", - "prost", + "prost 0.13.3", "prost-types", "regex", "syn 2.0.87", @@ -4741,13 +4840,26 @@ dependencies = [ "syn 2.0.87", ] +[[package]] +name = "prost-derive" +version = "0.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9552f850d5f0964a4e4d0bf306459ac29323ddfbae05e35a7c0d35cb0803cc5" +dependencies = [ + "anyhow", + "itertools 0.13.0", + "proc-macro2", + "quote", + "syn 2.0.87", +] + [[package]] name = "prost-types" -version = "0.12.6" +version = "0.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9091c90b0a32608e984ff2fa4091273cbdd755d54935c51d520887f4a1dbd5b0" +checksum = "4759aa0d3a6232fb8dbdb97b61de2c20047c68aca932c7ed76da9d788508d670" dependencies = [ - "prost", + "prost 0.13.3", ] [[package]] @@ -4779,6 +4891,58 @@ dependencies = [ "sptr", ] +[[package]] +name = "quinn" +version = "0.11.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62e96808277ec6f97351a2380e6c25114bc9e67037775464979f3037c92d05ef" +dependencies = [ + "bytes", + "pin-project-lite", + "quinn-proto", + "quinn-udp", + "rustc-hash 2.0.0", + "rustls 0.23.17", + "socket2 0.5.7", + "thiserror 2.0.3", + "tokio", + "tracing", +] + +[[package]] +name = "quinn-proto" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2fe5ef3495d7d2e377ff17b1a8ce2ee2ec2a18cde8b6ad6619d65d0701c135d" +dependencies = [ + "bytes", + "getrandom", + "rand", + "ring", + "rustc-hash 2.0.0", + "rustls 0.23.17", + "rustls-pki-types", + "slab", + "thiserror 2.0.3", + "tinyvec", + "tracing", + "web-time", +] + +[[package]] +name = "quinn-udp" +version = "0.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d5a626c6807713b15cac82a6acaccd6043c9a5408c24baae07611fec3f243da" +dependencies = [ + "cfg_aliases", + "libc", + "once_cell", + "socket2 0.5.7", + "tracing", + "windows-sys 0.59.0", +] + [[package]] name = "quote" version = "1.0.37" @@ -4972,29 +5136,23 @@ dependencies = [ "encoding_rs", "futures-core", "futures-util", - "h2", + "h2 0.3.26", "http 0.2.12", "http-body 0.4.6", "hyper 0.14.31", - "hyper-rustls 0.24.2", "ipnet", "js-sys", "log", "mime", - "mime_guess", "once_cell", "percent-encoding", "pin-project-lite", - "rustls 0.21.12", - "rustls-native-certs 0.6.3", - "rustls-pemfile 1.0.4", "serde", "serde_json", "serde_urlencoded", - "sync_wrapper", + "sync_wrapper 0.1.2", "system-configuration", "tokio", - "tokio-rustls 0.24.1", "tower-service", "url", "wasm-bindgen", @@ -5003,39 +5161,80 @@ dependencies = [ "winreg", ] +[[package]] +name = "reqwest" +version = "0.12.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a77c62af46e79de0a562e1a9849205ffcb7fc1238876e9bd743357570e04046f" +dependencies = [ + "base64 0.22.1", + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "http 1.1.0", + "http-body 1.0.1", + "http-body-util", + "hyper 1.5.0", + "hyper-rustls", + "hyper-util", + "ipnet", + "js-sys", + "log", + "mime", + "once_cell", + "percent-encoding", + "pin-project-lite", + "quinn", + "rustls 0.23.17", + "rustls-native-certs 0.8.0", + "rustls-pemfile", + "rustls-pki-types", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper 1.0.1", + "tokio", + "tokio-rustls 0.26.0", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "windows-registry", +] + [[package]] name = "reqwest-middleware" -version = "0.2.5" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a735987236a8e238bf0296c7e351b999c188ccc11477f311b82b55c93984216" +checksum = "562ceb5a604d3f7c885a792d42c199fd8af239d0a51b2fa6a78aafa092452b04" dependencies = [ "anyhow", "async-trait", - "http 0.2.12", - "reqwest", + "http 1.1.0", + "reqwest 0.12.9", "serde", - "task-local-extensions", "thiserror 1.0.69", + "tower-service", ] [[package]] name = "reqwest-retry" -version = "0.3.0" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9af20b65c2ee9746cc575acb6bd28a05ffc0d15e25c992a8f4462d8686aacb4f" +checksum = "a83df1aaec00176d0fabb65dea13f832d2a446ca99107afc17c5d2d4981221d0" dependencies = [ "anyhow", "async-trait", - "chrono", "futures", "getrandom", - "http 0.2.12", - "hyper 0.14.31", + "http 1.1.0", + "hyper 1.5.0", "parking_lot 0.11.2", - "reqwest", + "reqwest 0.12.9", "reqwest-middleware", "retry-policies", - "task-local-extensions", "tokio", "tracing", "wasm-timer", @@ -5043,12 +5242,10 @@ dependencies = [ [[package]] name = "retry-policies" -version = "0.2.1" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17dd00bff1d737c40dbcd47d4375281bf4c17933f9eef0a185fc7bacca23ecbd" +checksum = "5875471e6cab2871bc150ecb8c727db5113c9338cc3354dc5ee3425b6aa40a1c" dependencies = [ - "anyhow", - "chrono", "rand", ] @@ -5213,26 +5410,13 @@ dependencies = [ "sct", ] -[[package]] -name = "rustls" -version = "0.22.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf4ef73721ac7bcd79b2b315da7779d8fc09718c6b3d2d1b2d94850eb8c18432" -dependencies = [ - "log", - "ring", - "rustls-pki-types", - "rustls-webpki 0.102.8", - "subtle", - "zeroize", -] - [[package]] name = "rustls" version = "0.23.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f1a745511c54ba6d4465e8d5dfbd81b45791756de28d4981af70d6dca128f1e" dependencies = [ + "log", "once_cell", "ring", "rustls-pki-types", @@ -5243,38 +5427,30 @@ dependencies = [ [[package]] name = "rustls-native-certs" -version = "0.6.3" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9aace74cb666635c918e9c12bc0d348266037aa8eb599b5cba565709a8dff00" +checksum = "e5bfb394eeed242e909609f56089eecfe5fda225042e8b171791b9c95f5931e5" dependencies = [ "openssl-probe", - "rustls-pemfile 1.0.4", + "rustls-pemfile", + "rustls-pki-types", "schannel", "security-framework", ] [[package]] name = "rustls-native-certs" -version = "0.7.3" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5bfb394eeed242e909609f56089eecfe5fda225042e8b171791b9c95f5931e5" +checksum = "fcaf18a4f2be7326cd874a5fa579fae794320a0f388d365dca7e480e55f83f8a" dependencies = [ "openssl-probe", - "rustls-pemfile 2.2.0", + "rustls-pemfile", "rustls-pki-types", "schannel", "security-framework", ] -[[package]] -name = "rustls-pemfile" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" -dependencies = [ - "base64 0.21.7", -] - [[package]] name = "rustls-pemfile" version = "2.2.0" @@ -5289,6 +5465,9 @@ name = "rustls-pki-types" version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "16f1201b3c9a7ee8039bcadc17b7e605e2945b27eee7631788c1bd2b0643674b" +dependencies = [ + "web-time", +] [[package]] name = "rustls-webpki" @@ -6002,6 +6181,15 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" +[[package]] +name = "sync_wrapper" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" +dependencies = [ + "futures-core", +] + [[package]] name = "synstructure" version = "0.13.1" @@ -6295,6 +6483,21 @@ dependencies = [ "zerovec", ] +[[package]] +name = "tinyvec" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "445e881f4f6d382d5f27c034e25eb92edd7c784ceab92a0937db7f2e9471b938" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + [[package]] name = "tokio" version = "1.41.1" @@ -6344,17 +6547,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "tokio-rustls" -version = "0.25.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "775e0c0f0adb3a2f22a00c4745d728b479985fc15ee7ca6a2608388c5569860f" -dependencies = [ - "rustls 0.22.4", - "rustls-pki-types", - "tokio", -] - [[package]] name = "tokio-rustls" version = "0.26.0" @@ -6448,23 +6640,52 @@ checksum = "76c4eb7a4e9ef9d4763600161f12f5070b92a578e1b634db88a6887844c91a13" dependencies = [ "async-stream", "async-trait", - "axum", + "axum 0.6.20", "base64 0.21.7", "bytes", - "h2", + "h2 0.3.26", "http 0.2.12", "http-body 0.4.6", "hyper 0.14.31", - "hyper-timeout", + "hyper-timeout 0.4.1", "percent-encoding", "pin-project", - "prost", - "rustls-pemfile 2.2.0", - "rustls-pki-types", + "prost 0.12.6", "tokio", - "tokio-rustls 0.25.0", "tokio-stream", - "tower", + "tower 0.4.13", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tonic" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877c5b330756d856ffcc4553ab34a5684481ade925ecc54bcd1bf02b1d0d4d52" +dependencies = [ + "async-stream", + "async-trait", + "axum 0.7.9", + "base64 0.22.1", + "bytes", + "h2 0.4.6", + "http 1.1.0", + "http-body 1.0.1", + "http-body-util", + "hyper 1.5.0", + "hyper-timeout 0.5.2", + "hyper-util", + "percent-encoding", + "pin-project", + "prost 0.13.3", + "rustls-pemfile", + "socket2 0.5.7", + "tokio", + "tokio-rustls 0.26.0", + "tokio-stream", + "tower 0.4.13", "tower-layer", "tower-service", "tracing", @@ -6480,38 +6701,39 @@ dependencies = [ "http 0.2.12", "http-body 0.4.6", "pin-project", - "tonic", + "tonic 0.11.0", "tower-layer", "tower-service", ] [[package]] name = "tonic-build" -version = "0.11.0" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be4ef6dd70a610078cb4e338a0f79d06bc759ff1b22d2120c2ff02ae264ba9c2" +checksum = "9557ce109ea773b399c9b9e5dca39294110b74f1f342cb347a80d1fce8c26a11" dependencies = [ "prettyplease", "proc-macro2", "prost-build", + "prost-types", "quote", "syn 2.0.87", ] [[package]] name = "tonic-web" -version = "0.11.0" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc3b0e1cedbf19fdfb78ef3d672cb9928e0a91a9cb4629cc0c916e8cff8aaaa1" +checksum = "5299dd20801ad736dccb4a5ea0da7376e59cd98f213bf1c3d478cf53f4834b58" dependencies = [ - "base64 0.21.7", + "base64 0.22.1", "bytes", - "http 0.2.12", - "http-body 0.4.6", - "hyper 0.14.31", + "http 1.1.0", + "http-body 1.0.1", + "http-body-util", "pin-project", "tokio-stream", - "tonic", + "tonic 0.12.3", "tower-http", "tower-layer", "tower-service", @@ -6534,7 +6756,7 @@ dependencies = [ "js-sys", "pin-project", "thiserror 1.0.69", - "tonic", + "tonic 0.11.0", "tower-service", "wasm-bindgen", "wasm-bindgen-futures", @@ -6562,18 +6784,34 @@ dependencies = [ "tracing", ] +[[package]] +name = "tower" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2873938d487c3cfb9aed7546dc9f2711d867c9f90c46b889989a2cb84eba6b4f" +dependencies = [ + "futures-core", + "futures-util", + "pin-project-lite", + "sync_wrapper 0.1.2", + "tokio", + "tower-layer", + "tower-service", + "tracing", +] + [[package]] name = "tower-http" -version = "0.4.4" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61c5bb1d698276a2443e5ecfabc1008bf15a36c12e6a7176e7bf089ea9131140" +checksum = "1e9cd434a998747dd2c4276bc96ee2e0c7a2eadf3cae88e52be55a05fa9053f5" dependencies = [ "bitflags 2.6.0", "bytes", - "futures-core", "futures-util", - "http 0.2.12", - "http-body 0.4.6", + "http 1.1.0", + "http-body 1.0.1", + "http-body-util", "http-range-header", "httpdate", "mime", @@ -7568,6 +7806,36 @@ dependencies = [ "windows-targets 0.52.6", ] +[[package]] +name = "windows-registry" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e400001bb720a623c1c69032f8e3e4cf09984deec740f007dd2b03ec864804b0" +dependencies = [ + "windows-result", + "windows-strings", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-result" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-strings" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10" +dependencies = [ + "windows-result", + "windows-targets 0.52.6", +] + [[package]] name = "windows-sys" version = "0.48.0" diff --git a/Cargo.toml b/Cargo.toml index 4c34582e6..da36f12f6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -48,9 +48,9 @@ opendut-vpn = { path = "opendut-vpn" } anyhow = "1.0.79" assert_fs = "1.1.1" async-trait = "0.1.77" -axum = "0.6.20" -axum-server = "0.5.1" -axum-server-dual-protocol = "0.5.2" +axum = "0.7.5" +axum-server = "0.6.0" +axum-server-dual-protocol = "0.6.0" backon = { version = "1.2.0", default-features = false } base64 = "0.22.1" brotli = "7.0.0" @@ -81,7 +81,7 @@ gloo-net = { version = "0.5.0" } gloo-timers = { version = "0.3.0" } googletest = { version = "0.12.0" } home = "0.5.5" -http = "0.2.12" +http = "1.1.0" indicatif = "0.17.7" indoc = "2.0.4" jsonwebtoken = "9.2.0" @@ -94,27 +94,27 @@ mockall = "0.13.0" netlink-packet-route = "0.19.0" netlink-packet-utils = "0.5.2" nix = "0.29.0" -oauth2 = { version = "4.4.2", default-features = false } -openidconnect = { version = "3.5.0", default-features = false } +oauth2 = { version = "5.0.0-alpha.4", default-features = false } +openidconnect = { version = "4.0.0-alpha.2", default-features = false } openssl-sys = { version = "0.9.102", features = ["vendored"] } opentelemetry = "0.23.0" opentelemetry-appender-tracing = "0.4.0" opentelemetry-otlp = "0.16.0" opentelemetry_sdk = "0.23.0" opentelemetry-semantic-conventions = "0.15.0" -pem = {version = "3.0.3", features = ["serde"]} +pem = { version = "3.0.3", features = ["serde"] } phf = { version = "0.11", features = ["macros"] } ping-rs = { version = "0.1.2" } pq-sys = { version = "0.6.1", features = ["bundled"] } predicates = "3.0.4" -prost = "0.12.1" -prost-build = "0.12.1" -prost-types = "0.12.1" +prost = "0.13.1" +prost-build = "0.13.1" +prost-types = "0.13.1" protobuf-src = "1.1.0" regex = "1.10.2" -reqwest = { version = "0.11.23", default-features = false, features = ["rustls-tls-native-roots"] } -reqwest-middleware = "0.2.4" -reqwest-retry = "0.3.0" +reqwest = { version = "0.12.5", default-features = false, features = ["rustls-tls-native-roots"] } +reqwest-middleware = "0.3.2" +reqwest-retry = "0.6.0" rstest = "0.23.0" rtnetlink = "0.14.1" serde = { version = "1.0.204", default-features = false } @@ -139,13 +139,13 @@ thiserror = "2.0.3" tokio = { version = "1.35.1", default-features = false } tokio-stream = { version = "0.1.14", default-features = false } toml_edit = "0.22.15" -tonic = { version = "0.11.0", default-features = false } -tonic-build = { version = "0.11.0", default-features = false } -tonic-web = "0.11.0" +tonic = { version = "0.12.0", default-features = false } +tonic-build = { version = "0.12.0", default-features = false } +tonic-web = "0.12.0" tonic-web-wasm-client = { version = "0.5.1" } tonic-async-interceptor = { version = "0.11.0" } tower = "0.4.13" -tower-http = { version = "0.4.4", features = ["cors", "fs"] } +tower-http = { version = "0.5.2", features = ["cors", "fs"] } tracing = { version = "0.1.40" } tracing-opentelemetry = "0.24.0" tracing-subscriber = { version = "0.3.18", default-features = false } diff --git a/opendut-carl/opendut-carl-api/build.rs b/opendut-carl/opendut-carl-api/build.rs index b36ddadbc..fba6861e8 100644 --- a/opendut-carl/opendut-carl-api/build.rs +++ b/opendut-carl/opendut-carl-api/build.rs @@ -14,7 +14,7 @@ fn main() -> Result<(), Box> { ".opendut.types", "opendut_types::proto" ) - .compile(&protos, &includes)?; + .compile_protos(&protos, &includes)?; Ok(()) } diff --git a/opendut-types/src/proto/peer/mod.rs b/opendut-types/src/proto/peer/mod.rs index 90e5891c1..71239fb49 100644 --- a/opendut-types/src/proto/peer/mod.rs +++ b/opendut-types/src/proto/peer/mod.rs @@ -384,7 +384,7 @@ mod tests { ok(eq(&native)) ); - assert_that!(PeerId::from(native), eq(&proto)); + assert_that!(&PeerId::from(native), eq(&proto)); Ok(()) } diff --git a/opendut-util/opendut-auth/Cargo.toml b/opendut-util/opendut-auth/Cargo.toml index f7fd99806..90c2a616d 100644 --- a/opendut-util/opendut-auth/Cargo.toml +++ b/opendut-util/opendut-auth/Cargo.toml @@ -44,10 +44,10 @@ chrono = { workspace = true, optional = true, default-features = false, features config = { workspace = true, optional = true } http = { workspace = true, optional = true } leptos_oidc = { workspace = true, optional = true } -openidconnect = { workspace = true, optional = true, default-features = false, features = ["reqwest"] } -oauth2 = { workspace = true, default-features = false, optional = true, features = ["reqwest"] } +openidconnect = { workspace = true, optional = true, default-features = false, features = ["reqwest-blocking"] } +oauth2 = { workspace = true, default-features = false, optional = true, features = ["reqwest-blocking"] } pem = { workspace = true, optional = true, features = ["serde"]} -reqwest = { workspace = true, default-features = false, features = ["rustls-tls-native-roots"] } +reqwest = { workspace = true, default-features = false, features = ["blocking", "rustls-tls-native-roots"] } serde = { workspace = true, features = ["std", "derive"] } shadow-rs = { workspace = true, default-features = false, optional = true, features = ["tzdb"] } thiserror = { workspace = true } diff --git a/opendut-util/opendut-auth/opendut-auth-tests/src/lib.rs b/opendut-util/opendut-auth/opendut-auth-tests/src/lib.rs index 004e853db..614ea4ca7 100644 --- a/opendut-util/opendut-auth/opendut-auth-tests/src/lib.rs +++ b/opendut-util/opendut-auth/opendut-auth-tests/src/lib.rs @@ -59,6 +59,8 @@ pub async fn registration_client(#[future] confidential_carl_client: Confidentia mod auth_tests { use googletest::assert_that; use googletest::matchers::eq; + use http::HeaderValue; + use pem::Pem; use rstest::rstest; use opendut_auth::registration::client::{Clients, RegistrationClientRef}; diff --git a/opendut-util/opendut-auth/src/confidential/blocking/client.rs b/opendut-util/opendut-auth/src/confidential/blocking/client.rs index ac7d4b916..e1848419d 100644 --- a/opendut-util/opendut-auth/src/confidential/blocking/client.rs +++ b/opendut-util/opendut-auth/src/confidential/blocking/client.rs @@ -1,11 +1,11 @@ use crate::confidential::blocking::reqwest_client::OidcBlockingReqwestClient; -use crate::confidential::config::{ConfidentialClientConfig, ConfidentialClientConfigData}; +use crate::confidential::config::{ConfidentialClientConfig, ConfidentialClientConfigData, ConfiguredClient}; use crate::confidential::error::{ConfidentialClientError, WrappedRequestTokenError}; use crate::TOKEN_GRACE_PERIOD; use backon::BlockingRetryable; use chrono::{NaiveDateTime, Utc}; use config::Config; -use oauth2::basic::{BasicClient, BasicTokenResponse}; +use oauth2::basic::BasicTokenResponse; use oauth2::{AccessToken, TokenResponse}; use std::fmt::Formatter; use std::ops::Sub; @@ -21,7 +21,7 @@ use tracing::debug; #[derive(Debug)] pub struct ConfidentialClient { - inner: BasicClient, + inner: ConfiguredClient, pub reqwest_client: OidcBlockingReqwestClient, pub config: ConfidentialClientConfigData, @@ -152,7 +152,7 @@ impl ConfidentialClient { fn fetch_token(&self) -> Result { let response = self.inner.exchange_client_credentials() .add_scopes(self.config.scopes.clone()) - .request(|request| { self.reqwest_client.sync_http_client(request) }) + .request(&|request| { self.reqwest_client.sync_http_client(request) }) .map_err(|error| { AuthError::FailedToGetToken { message: "Fetching authentication token failed!".to_string(), @@ -264,7 +264,7 @@ mod auth_tests { let reqwest_client = blocking::reqwest_client::OidcBlockingReqwestClient::from_pem(certificate).unwrap(); let response = client.exchange_client_credentials() .add_scopes(vec![]) - .request(|request| reqwest_client.sync_http_client(request)) + .request(&|request| reqwest_client.sync_http_client(request)) .expect("Failed to get token"); let now = Utc::now().naive_utc(); diff --git a/opendut-util/opendut-auth/src/confidential/blocking/reqwest_client.rs b/opendut-util/opendut-auth/src/confidential/blocking/reqwest_client.rs index ac4ec07e6..01d3351df 100644 --- a/opendut-util/opendut-auth/src/confidential/blocking/reqwest_client.rs +++ b/opendut-util/opendut-auth/src/confidential/blocking/reqwest_client.rs @@ -61,10 +61,11 @@ impl OidcBlockingReqwestClient { request: HttpRequest, ) -> Result { let client = self.client.clone(); + let mut request_builder = client - .request(request.method, request.url.as_str()) - .body(request.body); - for (name, value) in &request.headers { + .request(request.method().clone(), request.uri().to_string()) + .body(request.body().clone()); + for (name, value) in request.headers() { request_builder = request_builder.header(name.as_str(), value.as_bytes()); } let request = request_builder.build() @@ -81,10 +82,20 @@ impl OidcBlockingReqwestClient { .map_err(|cause| { OidcClientError::AuthReqwest { message: cause.to_string(), status: cause.status().unwrap_or_default().to_string(), inner: cause } })?; - Ok(HttpResponse { - status_code, - headers, - body: data.to_vec(), - }) + + let returned_response = { + let mut returned_response = http::Response::builder() + .status(status_code); + for (name, value) in headers.iter() { + returned_response = returned_response.header(name, value); + } + returned_response + .body(data.to_vec()) + .map_err(|cause| { + OidcClientError::Other(format!("Failed to build response body: {cause}")) + })? + }; + + Ok(returned_response) } } diff --git a/opendut-util/opendut-auth/src/confidential/client.rs b/opendut-util/opendut-auth/src/confidential/client.rs index 206576a49..1d3bbee6c 100644 --- a/opendut-util/opendut-auth/src/confidential/client.rs +++ b/opendut-util/opendut-auth/src/confidential/client.rs @@ -1,20 +1,22 @@ use std::fmt::Formatter; use std::ops::Sub; use std::sync::Arc; + use chrono::{NaiveDateTime, Utc}; use config::Config; use oauth2::{AccessToken, TokenResponse}; -use oauth2::basic::{BasicClient, BasicTokenResponse}; +use oauth2::basic::{BasicTokenResponse}; use tokio::sync::{RwLock, RwLockWriteGuard}; use tracing::debug; -use crate::confidential::config::{ConfidentialClientConfig, ConfidentialClientConfigData}; -use crate::confidential::reqwest_client::OidcReqwestClient; + +use crate::confidential::config::{ConfidentialClientConfig, ConfidentialClientConfigData, ConfiguredClient}; use crate::confidential::error::{ConfidentialClientError, WrappedRequestTokenError}; use crate::TOKEN_GRACE_PERIOD; +use crate::confidential::reqwest_client::OidcReqwestClient; #[derive(Debug)] pub struct ConfidentialClient { - inner: BasicClient, + inner: ConfiguredClient, pub reqwest_client: OidcReqwestClient, pub config: ConfidentialClientConfigData, @@ -106,7 +108,7 @@ impl ConfidentialClient { async fn fetch_token(&self) -> Result { let response = self.inner.exchange_client_credentials() .add_scopes(self.config.scopes.clone()) - .request_async(|request| { self.reqwest_client.async_http_client(request) }) + .request_async(&|request| { self.reqwest_client.async_http_client(request) }) .await .map_err(|error| { AuthError::FailedToGetToken { @@ -152,9 +154,11 @@ mod auth_tests { use pem::Pem; use rstest::{fixture, rstest}; use url::Url; + use opendut_util_core::project; - use crate::confidential::config::ConfidentialClientConfigData; + use crate::confidential::client::{ConfidentialClient, ConfidentialClientRef}; + use crate::confidential::config::ConfidentialClientConfigData; use crate::confidential::pem::PemFromConfig; use crate::confidential::reqwest_client::OidcReqwestClient; diff --git a/opendut-util/opendut-auth/src/confidential/config.rs b/opendut-util/opendut-auth/src/confidential/config.rs index bfb854a2f..2992a1886 100644 --- a/opendut-util/opendut-auth/src/confidential/config.rs +++ b/opendut-util/opendut-auth/src/confidential/config.rs @@ -1,11 +1,25 @@ use config::Config; -use oauth2::{AuthUrl, ClientId as OAuthClientId, ClientSecret as OAuthClientSecret, Scope as OAuthScope, TokenUrl}; +use oauth2::{AuthUrl, ClientId as OAuthClientId, ClientSecret as OAuthClientSecret, EndpointNotSet, EndpointSet, Scope as OAuthScope, TokenUrl}; use oauth2::basic::BasicClient; use shadow_rs::formatcp; use url::Url; use crate::confidential::error::ConfidentialClientError; +pub type ConfiguredClient< + HasAuthUrl = EndpointSet, + HasDeviceAuthUrl = EndpointNotSet, + HasIntrospectionUrl = EndpointNotSet, + HasRevocationUrl = EndpointNotSet, + HasTokenUrl = EndpointSet, +> = BasicClient< + HasAuthUrl, + HasDeviceAuthUrl, + HasIntrospectionUrl, + HasRevocationUrl, + HasTokenUrl, +>; + #[derive(Clone, Debug)] pub enum ConfidentialClientConfig { Confidential(ConfidentialClientConfigData), @@ -61,18 +75,18 @@ impl ConfidentialClientConfigData { } } - pub fn get_client(&self) -> Result { + pub fn get_client(&self) -> Result { let auth_endpoint = self.issuer_url.join("protocol/openid-connect/auth") .map_err(|cause| ConfidentialClientError::Configuration { message: String::from("Failed to derive authorization url from issuer url."), cause: cause.into() })?; let token_endpoint = self.issuer_url.join("protocol/openid-connect/token") .map_err(|cause| ConfidentialClientError::Configuration { message: String::from("Failed to derive token url from issuer url."), cause: cause.into() })?; - Ok(BasicClient::new( - self.client_id.clone(), - Some(self.client_secret.clone()), - AuthUrl::from_url(auth_endpoint), - Some(TokenUrl::from_url(token_endpoint)), - )) + let client = BasicClient::new(self.client_id.clone()) + .set_client_secret(self.client_secret.clone()) + .set_auth_uri(AuthUrl::from_url(auth_endpoint)) + .set_token_uri(TokenUrl::from_url(token_endpoint)); + + Ok(client) } } diff --git a/opendut-util/opendut-auth/src/confidential/reqwest_client.rs b/opendut-util/opendut-auth/src/confidential/reqwest_client.rs index 214b1cfdb..524f772fc 100644 --- a/opendut-util/opendut-auth/src/confidential/reqwest_client.rs +++ b/opendut-util/opendut-auth/src/confidential/reqwest_client.rs @@ -72,9 +72,9 @@ impl OidcReqwestClient { ) -> Result { let client = self.client.clone(); let mut request_builder = client - .request(request.method, request.url.as_str()) - .body(request.body); - for (name, value) in &request.headers { + .request(request.method().clone(), request.uri().to_string()) + .body(request.body().clone()); + for (name, value) in request.headers() { request_builder = request_builder.header(name.as_str(), value.as_bytes()); } let request = request_builder.build() @@ -91,10 +91,20 @@ impl OidcReqwestClient { .map_err(|cause| { OidcClientError::AuthReqwest { message: cause.to_string(), status: cause.status().unwrap_or_default().to_string(), inner: cause } })?; - Ok(HttpResponse { - status_code, - headers, - body: data.to_vec(), - }) + + let returned_response = { + let mut returned_response = http::Response::builder() + .status(status_code); + for (name, value) in headers.iter() { + returned_response = returned_response.header(name, value); + } + returned_response + .body(data.to_vec()) + .map_err(|cause| { + OidcClientError::Other(format!("Failed to build response body: {cause}")) + })? + }; + + Ok(returned_response) } } diff --git a/opendut-util/opendut-auth/src/confidential/tonic_service.rs b/opendut-util/opendut-auth/src/confidential/tonic_service.rs index eb6fd4137..efbd734e1 100644 --- a/opendut-util/opendut-auth/src/confidential/tonic_service.rs +++ b/opendut-util/opendut-auth/src/confidential/tonic_service.rs @@ -4,7 +4,7 @@ use std::sync::Arc; use std::task::{Context, Poll}; use http::{HeaderValue, Request, Response}; use tonic::body::BoxBody; -use tonic::transport::{Body, Channel}; +use tonic::transport::Channel; use tower::Service; use tracing::error; use crate::confidential::client::ConfidentialClient; @@ -28,10 +28,11 @@ impl TonicAuthenticationService { } impl Service> for TonicAuthenticationService { - type Response = Response; + type Response = Response; type Error = Box; #[allow(clippy::type_complexity)] - type Future = Pin> + Send>>; + type Future = Pin>>>; + fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll> { self.inner.poll_ready(cx).map_err(Into::into) } @@ -49,7 +50,7 @@ impl Service> for TonicAuthenticationService { let token_result = confidential_client.as_ref() .map(|manager| manager.get_token()); - return match token_result { + match token_result { None => { // Authentication disabled Ok(inner.call(request).await?) @@ -75,7 +76,7 @@ impl Service> for TonicAuthenticationService { } } } - }; + } }) } } diff --git a/opendut-util/opendut-auth/src/registration/client.rs b/opendut-util/opendut-auth/src/registration/client.rs index 33e0ffb53..c9ffd085b 100644 --- a/opendut-util/opendut-auth/src/registration/client.rs +++ b/opendut-util/opendut-auth/src/registration/client.rs @@ -1,4 +1,3 @@ -use std::ops::Not; use std::sync::Arc; use config::Config; @@ -118,7 +117,7 @@ impl RegistrationClient { .set_client_uri(Some(vec![(None, client_home_uri)] .into_iter() .collect())) - .register_async(®istration_url, move |request| { + .register_async(®istration_url, &move |request| { self.inner.reqwest_client.async_http_client(request) }).await; match response {