Hi folks! We're attempting to use PactJS to verify...
# pact-js
j
Hi folks! We're attempting to use PactJS to verify the contract between one of our services, and our OIDC auth service - specifically, the
/token
endpoint. As per the OIDC spec, we've implemented the
/token
endpoint to accept a request with
Content-Type
of
application/x-www-form-urlencoded
. The intention was for us to use
fromProviderState
to match the body and allow a valid authentication grant to be generated and injected by the provider tests. However, it seems Pact doesn't currently support matchers on unstructured body content (https://github.com/pact-foundation/pact-js/issues/767). Second attempt - we looked at ignoring the body in the contract spec, and then using
reqFilter
in the
Verifier
to generated and inject the authN grant into the body. But we then ran into an outstanding bug which means unstructured content doesn't get injected correctly into the request body (https://github.com/pact-foundation/pact-js/issues/884). Is there another approach we're missing here? And is there any priority being given to address either of these issues? Many thanks!
t
I don’t believe Pact supports this yet, and I don’t know what the priorities are. But, why are you testing an OIDC endpoint? Did you hand roll your token negotiation?
j
Thanks Tim. I was mostly checking that I hadn't missed something - if it's not supported, then that's just how it is. We have some customisation of the claims which are yielded in our access token, as well as other configuration changes. We're by no means using Pact as our primary means of testing these, but as a general rule, we aim to use Pact to verify any contract relationships between different components in our architecture.
👍 2
m
Yeah, that’s the use case I’ve seen for JWT validation. Other data comes along in the claims, and that is important to certain functionality.
But as Tim said, we don’t currently support that.
The bugs have been added to a backlog for review, we haven’t published timelines for it yet, so if you wanted to have a look into it you could definitely have a crack at fixing it. #884 is probably relatively simple. #767 would need to be implemented in a Plugin for Pact, or added to the core engine