Hi there,
I'm struggling to setup a digest authentication on SOAP service. It seems that only Basic Auth is supported out-of-the-box.
I'm providing the Digest realm in the DispatchClientAsync as follows:
import com.ning.http.client.Realm.{RealmBuilder, AuthScheme}
trait DispatchHttpClientsAsync extends HttpClientsAsync {
lazy val httpClient = new DispatchHttpClient {}
trait DispatchHttpClient extends HttpClient {
import dispatch._, Defaults._
val http = new Http()
def request(in: String, address: java.net.URI, headers: Map[String, String]): concurrent.Future[String] = {
val realm = new RealmBuilder()
.setScheme(AuthScheme.DIGEST)
.setRealmName("Digest") // as returned from the server
.setPrincipal("<username>")
.setPassword("<password>")
.setNonce("<Here I manually copy the nonce returned from server. If it works, I'll automatize this>")
.setAlgorithm("MD5-sess") // as returned from the server
.build()
val req = url(address.toString).setBodyEncoding("UTF-8").setRealm(realm) <:< headers << in
http(req > as.String)
}
}
}
However, I'm still getting 401 Not Authorized.
I tried SoapUI, the credentials are ok. Before I run this code, I manually replace the nonce with a fresh one coming from the server.
Is there something I'm missing?
Thanks.