Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scala-pact does not support HTTP Basic auth? #110

Closed
jnatten opened this issue Nov 19, 2018 · 1 comment
Closed

scala-pact does not support HTTP Basic auth? #110

jnatten opened this issue Nov 19, 2018 · 1 comment

Comments

@jnatten
Copy link
Contributor

jnatten commented Nov 19, 2018

I've tried to set it up in my pact.sbt like this:
pactBrokerAddress := "http://username:password@pact-broker.local"

and whenever i run sbt pactPublish everything seems to go okay until the last second (when the actual publishing happens):

SimpleResponse(401,Map(Server -> nginx/1.14.0 + Phusion Passenger 5.3.6, Connection -> keep-alive, Content-Length -> 0, WWW-Authenticate -> Basic realm="Restricted area", Content-Type -> text/plain, Date -> Mon, 19 Nov 2018 09:32:28 GMT, X-Powered-By -> Phusion Passenger 5.3.6, Status -> 401 Unauthorized),Some())
Failed: 401, Some()

If i replace the header here:

With this (dXNlcm5hbWU6cGFzc3dvcmQ= is "username:password" base64 encoded):

Map("Content-Type" -> "application/json", "Authorization" -> "Basic dXNlcm5hbWU6cGFzc3dvcmQ="),

The publish works and everything is fine.

Would you like me to create a pull-request adding basic auth header to requests to a broker?

@jnatten jnatten changed the title scala-pact does not support HTTP Basic auth scala-pact does not support HTTP Basic auth? Nov 19, 2018
@jnatten
Copy link
Contributor Author

jnatten commented Nov 26, 2018

This could be implemented by adding the authorization header when creating the SimpleRequest (By parsing the url with a simple regex).
Another option could be to parse the url in the implementations of IScalaPactHttpClient.

What do you think @davesmith00000 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant