@@ -459,6 +459,42 @@ nodeOnly(() => {
459459
460460 expect ( response ) . to . equal ( "OK" ) ;
461461 } ) ;
462+
463+ it ( "uses a wildcard client certificate for the hostname" , async ( ) => {
464+ await server . forAnyRequest ( ) . thenPassThrough ( {
465+ ignoreHostHttpsErrors : [ 'localhost' ] ,
466+ clientCertificateHostMap : {
467+ [ '*' ] : {
468+ pfx : await fs . readFile ( './test/fixtures/test-ca.pfx' ) ,
469+ passphrase : 'test-passphrase'
470+ }
471+ }
472+ } ) ;
473+
474+ let response = await request . get ( `https://localhost:${ authenticatingServerPort } /` ) ;
475+
476+ expect ( response ) . to . equal ( "OK" ) ;
477+ } ) ;
478+
479+ it ( "uses a hostname-specific client certificate in preference over a wildcard" , async ( ) => {
480+ await server . forAnyRequest ( ) . thenPassThrough ( {
481+ ignoreHostHttpsErrors : [ 'localhost' ] ,
482+ clientCertificateHostMap : {
483+ '*' : { // If this were selected, it wouldn't work - passphrase is wrong
484+ pfx : await fs . readFile ( './test/fixtures/test-ca.pfx' ) ,
485+ passphrase : 'TOTALLY-WRONG-PASSPHRASE'
486+ } ,
487+ [ `localhost:${ authenticatingServerPort } ` ] : {
488+ pfx : await fs . readFile ( './test/fixtures/test-ca.pfx' ) ,
489+ passphrase : 'test-passphrase'
490+ }
491+ }
492+ } ) ;
493+
494+ let response = await request . get ( `https://localhost:${ authenticatingServerPort } /` ) ;
495+
496+ expect ( response ) . to . equal ( "OK" ) ;
497+ } ) ;
462498 } ) ;
463499 } ) ;
464500
0 commit comments