Skip to content

Commit 436ad58

Browse files
authored
Merge pull request #2596 from rajatjindal/client-certs
add support for client certs
2 parents 7833e71 + 8604bb2 commit 436ad58

File tree

14 files changed

+1101
-418
lines changed

14 files changed

+1101
-418
lines changed

Cargo.lock

Lines changed: 28 additions & 90 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/trigger-http/Cargo.toml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ http-body-util = { workspace = true }
2020
indexmap = "1"
2121
outbound-http = { path = "../outbound-http" }
2222
percent-encoding = "2"
23-
rustls-pemfile = "0.3.0"
23+
rustls = { version = "0.22.0" }
24+
rustls-pemfile = "2.1.2"
25+
rustls-pki-types = "1.7"
2426
serde = { version = "1.0", features = ["derive"] }
2527
serde_json = "1"
2628
spin-app = { path = "../app" }
@@ -33,13 +35,14 @@ spin-world = { path = "../world" }
3335
terminal = { path = "../terminal" }
3436
tls-listener = { version = "0.10.0", features = ["rustls"] }
3537
tokio = { version = "1.23", features = ["full"] }
36-
tokio-rustls = { version = "0.23.2" }
38+
tokio-rustls = { version = "0.25.0" }
3739
url = "2.4.1"
3840
tracing = { workspace = true }
3941
wasmtime = { workspace = true }
4042
wasmtime-wasi = { workspace = true }
4143
wasmtime-wasi-http = { workspace = true }
4244
wasi-common-preview1 = { workspace = true }
45+
webpki-roots = { version = "0.26.0" }
4346

4447
[dev-dependencies]
4548
criterion = { version = "0.3.5", features = ["async_tokio"] }

crates/trigger-http/src/handler.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,14 @@ impl HttpExecutor for HttpHandlerExecutor {
4848

4949
set_http_origin_from_request(&mut store, engine.clone(), self, &req);
5050

51+
// set the client tls options for the current component_id.
52+
// The OutboundWasiHttpHandler in this file is only used
53+
// when making http-request from a http-trigger component.
54+
// The outbound http requests from other triggers such as Redis
55+
// uses OutboundWasiHttpHandler defined in spin_core crate.
56+
store.as_mut().data_mut().as_mut().client_tls_opts =
57+
engine.get_client_tls_opts(component_id);
58+
5159
let resp = match ty {
5260
HandlerType::Spin => {
5361
Self::execute_spin(store, instance, base, route_match, req, client_addr)

0 commit comments

Comments
 (0)