You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 8f53cfa
Browse filesBrowse the repository at this point in the historyBrowse files
fix(cli): propagate --gateway-insecure to OIDC auth flows
Thread the gateway_insecure flag through gateway_add(), gateway_login(),
and all OIDC HTTP clients so that --gateway-insecure and
OPENSHELL_GATEWAY_INSECURE apply to OIDC discovery, token exchange, and
token refresh requests.
Previously, the flag only affected gRPC connections to the gateway. OIDC
HTTP clients (reqwest::get and http_client) always verified TLS
certificates, causing gateway registration and login to fail when the
OIDC issuer used a self-signed certificate (common on OpenShift with
edge-terminated routes).
Fixes#1534
Signed-off-by: Adel Zaalouk <[email protected]>
// A real self-signed server isn't available in unit tests, but we can
458
+
// verify the client is constructed and makes requests. The secure client
459
+
// should exist and function for valid endpoints.
460
+
let result = rt.block_on(async{ client.get("https://127.0.0.1:1").send().await});
461
+
assert!(result.is_err(),"connection to closed port should fail");
462
+
}
463
+
464
+
#[test]
465
+
fnhttp_client_insecure_builds_without_panic(){
466
+
let client = http_client(true);
467
+
// Verify the client is usable (doesn't panic on construction).
468
+
let rt = tokio::runtime::Runtime::new().unwrap();
469
+
let result = rt.block_on(async{ client.get("https://127.0.0.1:1").send().await});
470
+
assert!(result.is_err(),"connection to closed port should fail");
471
+
}
472
+
473
+
#[test]
474
+
fndiscover_validates_issuer_mismatch(){
475
+
let rt = tokio::runtime::Runtime::new().unwrap();
476
+
// Discovery against a non-existent issuer should fail with a
477
+
// connection error, not silently succeed.
478
+
let result = rt.block_on(discover("http://127.0.0.1:1/realms/test",false));
479
+
assert!(result.is_err());
480
+
}
481
+
482
+
#[test]
483
+
fndiscover_insecure_passes_flag_through(){
484
+
let rt = tokio::runtime::Runtime::new().unwrap();
485
+
// Same as above but with insecure=true. Should still fail on
486
+
// connection (no server) but must not panic.
487
+
let result = rt.block_on(discover("https://127.0.0.1:1/realms/test",true));
let bundle = bundle_from_oauth2_response(&token_response,"https://issuer","my-client");
0 commit comments