Skip to content

Commit fe6d3ca

Browse files
committed
test(oauth2): escape Windows path backslashes in MtlsPipelineLocalTest JSON templates
1 parent 2a6a58b commit fe6d3ca

1 file changed

Lines changed: 16 additions & 12 deletions

File tree

‎google-auth-library-java/oauth2_http/javatests/com/google/auth/oauth2/MtlsPipelineLocalTest.java‎

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -347,15 +347,16 @@ public void handle(HttpExchange exchange) throws IOException {
347347
+ "/v1/token\",\n"
348348
+ " \"credential_source\": {\n"
349349
+ " \"file\": \""
350-
+ tokenFile.toString()
350+
+ tokenFile.toString().replace("\\", "\\\\")
351351
+ "\",\n"
352352
+ " \"format\": {\n"
353353
+ " \"type\": \"json\",\n"
354354
+ " \"subject_token_field_name\": \"subject_token\",\n"
355355
+ " \"actor_token_field_name\": \"actor_token\"\n"
356356
+ " },\n"
357357
+ " \"certificate\": {\n"
358-
+ " \"certificate_config_location\": \"testresources/mtls/certificate_config.json\"\n"
358+
+ " \"certificate_config_location\":"
359+
+ " \"testresources/mtls/certificate_config.json\"\n"
359360
+ " }\n"
360361
+ " }\n"
361362
+ "}";
@@ -468,15 +469,16 @@ public void handle(HttpExchange exchange) throws IOException {
468469
+ "/v1/token\",\n"
469470
+ " \"credential_source\": {\n"
470471
+ " \"file\": \""
471-
+ tokenFile.toString()
472+
+ tokenFile.toString().replace("\\", "\\\\")
472473
+ "\",\n"
473474
+ " \"format\": {\n"
474475
+ " \"type\": \"json\",\n"
475476
+ " \"subject_token_field_name\": \"subject_token\",\n"
476477
+ " \"actor_token_field_name\": \"actor_token\"\n"
477478
+ " },\n"
478479
+ " \"certificate\": {\n"
479-
+ " \"certificate_config_location\": \"testresources/mtls/certificate_config.json\"\n"
480+
+ " \"certificate_config_location\":"
481+
+ " \"testresources/mtls/certificate_config.json\"\n"
480482
+ " }\n"
481483
+ " }\n"
482484
+ "}";
@@ -566,15 +568,16 @@ public void handle(HttpExchange exchange) throws IOException {
566568
+ "/v1/token\",\n"
567569
+ " \"credential_source\": {\n"
568570
+ " \"file\": \""
569-
+ tokenFile.toString()
571+
+ tokenFile.toString().replace("\\", "\\\\")
570572
+ "\",\n"
571573
+ " \"format\": {\n"
572574
+ " \"type\": \"json\",\n"
573575
+ " \"subject_token_field_name\": \"subject_token\",\n"
574576
+ " \"actor_token_field_name\": \"actor_token\"\n"
575577
+ " },\n"
576578
+ " \"certificate\": {\n"
577-
+ " \"certificate_config_location\": \"testresources/mtls/certificate_config.json\"\n"
579+
+ " \"certificate_config_location\":"
580+
+ " \"testresources/mtls/certificate_config.json\"\n"
578581
+ " }\n"
579582
+ " }\n"
580583
+ "}";
@@ -807,15 +810,16 @@ public void handle(HttpExchange exchange) throws IOException {
807810
+ "\",\n"
808811
+ " \"credential_source\": {\n"
809812
+ " \"file\": \""
810-
+ tokenFile.toString()
813+
+ tokenFile.toString().replace("\\", "\\\\")
811814
+ "\",\n"
812815
+ " \"format\": {\n"
813816
+ " \"type\": \"json\",\n"
814817
+ " \"subject_token_field_name\": \"subject_token\",\n"
815818
+ " \"actor_token_field_name\": \"actor_token\"\n"
816819
+ " },\n"
817820
+ " \"certificate\": {\n"
818-
+ " \"certificate_config_location\": \"testresources/mtls/certificate_config.json\"\n"
821+
+ " \"certificate_config_location\":"
822+
+ " \"testresources/mtls/certificate_config.json\"\n"
819823
+ " }\n"
820824
+ " }\n"
821825
+ "}";
@@ -881,10 +885,10 @@ void testMtlsPipeline_withImpersonation_401OnIam_retriesWithFreshCert(@TempDir P
881885
+ " \"cert_configs\": {\n"
882886
+ " \"workload\": {\n"
883887
+ " \"cert_path\": \""
884-
+ dynamicCertFile.toString()
888+
+ dynamicCertFile.toString().replace("\\", "\\\\")
885889
+ "\",\n"
886890
+ " \"key_path\": \""
887-
+ dynamicKeyFile.toString()
891+
+ dynamicKeyFile.toString().replace("\\", "\\\\")
888892
+ "\"\n"
889893
+ " }\n"
890894
+ " }\n"
@@ -994,7 +998,7 @@ public void handle(HttpExchange exchange) throws IOException {
994998
+ "\",\n"
995999
+ " \"credential_source\": {\n"
9961000
+ " \"file\": \""
997-
+ tokenFile.toString()
1001+
+ tokenFile.toString().replace("\\", "\\\\")
9981002
+ "\",\n"
9991003
+ " \"format\": {\n"
10001004
+ " \"type\": \"json\",\n"
@@ -1003,7 +1007,7 @@ public void handle(HttpExchange exchange) throws IOException {
10031007
+ " },\n"
10041008
+ " \"certificate\": {\n"
10051009
+ " \"certificate_config_location\": \""
1006-
+ certConfigFile.toString()
1010+
+ certConfigFile.toString().replace("\\", "\\\\")
10071011
+ "\"\n"
10081012
+ " }\n"
10091013
+ " }\n"

0 commit comments

Comments
 (0)