@@ -2169,7 +2169,7 @@ api = "https://api.example.com/access"
21692169
21702170 // ---------------------------------------------------------------------
21712171 // mTLS test: stand up a real HTTPS server requiring + verifying client
2172- // certs, and assert that --auth-tls-identity actually presents the cert.
2172+ // certs, and assert that --auth-tls-cert/--auth-tls-key present the cert.
21732173 // ---------------------------------------------------------------------
21742174
21752175 use rcgen:: { CertificateParams , KeyPair } ;
@@ -2180,14 +2180,15 @@ api = "https://api.example.com/access"
21802180 struct MtlsFixture {
21812181 _dir : TempDir ,
21822182 ca_pem_path : PathBuf ,
2183- client_identity_path : PathBuf ,
2183+ client_cert_path : PathBuf ,
2184+ client_key_path : PathBuf ,
21842185 base_url : String ,
21852186 key : Key ,
21862187 }
21872188
21882189 /// Spin up an HTTPS server on 127.0.0.1 that requires a client cert signed
21892190 /// by our test CA and serves `/keys/test-key.jwk`. Returns paths to the CA
2190- /// PEM and the client identity bundle so callers can configure `Auth`.
2191+ /// PEM and the client cert/key files so callers can configure `Auth`.
21912192 async fn mtls_fixture ( ) -> MtlsFixture {
21922193 // Install a default crypto provider for rustls. Idempotent across tests.
21932194 let _ = rustls:: crypto:: aws_lc_rs:: default_provider ( ) . install_default ( ) ;
@@ -2215,16 +2216,14 @@ api = "https://api.example.com/access"
22152216 . push ( rcgen:: DnType :: CommonName , "test-client" ) ;
22162217 let client_cert = client_params. signed_by ( & client_kp, & ca_cert, & ca_kp) . unwrap ( ) ;
22172218
2218- // 4. Write CA + client identity ( cert chain + private key bundle) to temp files.
2219+ // 4. Write CA + client cert/ key to temp files.
22192220 let dir = TempDir :: new ( ) . unwrap ( ) ;
22202221 let ca_pem_path = dir. path ( ) . join ( "ca.pem" ) ;
2221- let client_identity_path = dir. path ( ) . join ( "client.pem" ) ;
2222+ let client_cert_path = dir. path ( ) . join ( "client.cert.pem" ) ;
2223+ let client_key_path = dir. path ( ) . join ( "client.key.pem" ) ;
22222224 std:: fs:: write ( & ca_pem_path, ca_cert. pem ( ) ) . unwrap ( ) ;
2223- std:: fs:: write (
2224- & client_identity_path,
2225- format ! ( "{}{}" , client_cert. pem( ) , client_kp. serialize_pem( ) ) ,
2226- )
2227- . unwrap ( ) ;
2225+ std:: fs:: write ( & client_cert_path, client_cert. pem ( ) ) . unwrap ( ) ;
2226+ std:: fs:: write ( & client_key_path, client_kp. serialize_pem ( ) ) . unwrap ( ) ;
22282227
22292228 // 5. Build a rustls ServerConfig requiring + verifying client certs against the CA.
22302229 let mut roots = rustls:: RootCertStore :: empty ( ) ;
@@ -2262,7 +2261,8 @@ api = "https://api.example.com/access"
22622261 MtlsFixture {
22632262 _dir : dir,
22642263 ca_pem_path,
2265- client_identity_path,
2264+ client_cert_path,
2265+ client_key_path,
22662266 base_url : format ! ( "https://{addr}" ) ,
22672267 key,
22682268 }
@@ -2277,7 +2277,8 @@ api = "https://api.example.com/access"
22772277 key_dir : Some ( format ! ( "{}/keys/" , fx. base_url) ) ,
22782278 tls : AuthTls {
22792279 root : vec ! [ fx. ca_pem_path. clone( ) ] ,
2280- identity : Some ( fx. client_identity_path . clone ( ) ) ,
2280+ cert : Some ( fx. client_cert_path . clone ( ) ) ,
2281+ key : Some ( fx. client_key_path . clone ( ) ) ,
22812282 disable_verify : None ,
22822283 } ,
22832284 ..Default :: default ( )
@@ -2304,7 +2305,8 @@ api = "https://api.example.com/access"
23042305 key_dir : Some ( format ! ( "{}/keys/" , fx. base_url) ) ,
23052306 tls : AuthTls {
23062307 root : vec ! [ fx. ca_pem_path. clone( ) ] ,
2307- identity : None ,
2308+ cert : None ,
2309+ key : None ,
23082310 disable_verify : None ,
23092311 } ,
23102312 ..Default :: default ( )
0 commit comments