Skip to content

Commit

Permalink
feat: Update documentation on PactUrl authentication #1224
Browse files Browse the repository at this point in the history
  • Loading branch information
Ronald Holshausen committed Oct 18, 2020
1 parent 63d19cf commit 12348ef
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion provider/junit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 12348ef

Please sign in to comment.