Skip to content

Commit

Permalink
Merge pull request #2596 from rajatjindal/client-certs
Browse files Browse the repository at this point in the history
add support for client certs
  • Loading branch information
rajatjindal authored Jul 3, 2024
2 parents 7833e71 + 8604bb2 commit 436ad58
Show file tree
Hide file tree
Showing 14 changed files with 1,101 additions and 418 deletions.
118 changes: 28 additions & 90 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions crates/trigger-http/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ http-body-util = { workspace = true }
indexmap = "1"
outbound-http = { path = "../outbound-http" }
percent-encoding = "2"
rustls-pemfile = "0.3.0"
rustls = { version = "0.22.0" }
rustls-pemfile = "2.1.2"
rustls-pki-types = "1.7"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1"
spin-app = { path = "../app" }
Expand All @@ -33,13 +35,14 @@ spin-world = { path = "../world" }
terminal = { path = "../terminal" }
tls-listener = { version = "0.10.0", features = ["rustls"] }
tokio = { version = "1.23", features = ["full"] }
tokio-rustls = { version = "0.23.2" }
tokio-rustls = { version = "0.25.0" }
url = "2.4.1"
tracing = { workspace = true }
wasmtime = { workspace = true }
wasmtime-wasi = { workspace = true }
wasmtime-wasi-http = { workspace = true }
wasi-common-preview1 = { workspace = true }
webpki-roots = { version = "0.26.0" }

[dev-dependencies]
criterion = { version = "0.3.5", features = ["async_tokio"] }
Expand Down
8 changes: 8 additions & 0 deletions crates/trigger-http/src/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,14 @@ impl HttpExecutor for HttpHandlerExecutor {

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

// set the client tls options for the current component_id.
// The OutboundWasiHttpHandler in this file is only used
// when making http-request from a http-trigger component.
// The outbound http requests from other triggers such as Redis
// uses OutboundWasiHttpHandler defined in spin_core crate.
store.as_mut().data_mut().as_mut().client_tls_opts =
engine.get_client_tls_opts(component_id);

let resp = match ty {
HandlerType::Spin => {
Self::execute_spin(store, instance, base, route_match, req, client_addr)
Expand Down
Loading

0 comments on commit 436ad58

Please sign in to comment.