From 12348efb2bdae502921d1f3766c92973b432956f Mon Sep 17 00:00:00 2001 From: Ronald Holshausen Date: Sun, 18 Oct 2020 12:51:22 +1100 Subject: [PATCH] feat: Update documentation on PactUrl authentication #1224 --- provider/junit/README.md | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/provider/junit/README.md b/provider/junit/README.md index 67895b9fe5..644443a4de 100644 --- a/provider/junit/README.md +++ b/provider/junit/README.md @@ -334,11 +334,25 @@ you don't need to provide `pact.filter.consumers`. To use pacts from urls annotate the test class with ```java -@PactUrl(urls = {"http://build.server/zoo_app-animal_service.json"} ) +@PactUrl(urls = {"http://build.server/zoo_app-animal_service.json"}) ``` If you need to load a single pact file from the file system, you can use the `PactUrl` with the URL set to the file path. +For authenticated URLs, specify the authentication on the annotation + +```java +@PactUrl(urls = {"http://build.server/zoo_app-animal_service.json"}, authentication = @Authentication(token = "1234ABCD")) +``` + +You can use either bearer token scheme (by setting the `token`), or basic auth by setting the `username` and `password`. + +JVM system properties or environment variables can also be used by placing the property/variable name in `${}` expressions. + +```java +@PactUrl(urls = {"http://build.server/zoo_app-animal_service.json"}, authentication = @Authentication(token = "${TOKEN}")) +``` + ### Pact folder To use pacts from a resource folder of the project annotate test class with