[rest-gradle-plugin] 18/83: Added support for preemptive authentication

Alastair McKinstry mckinstry at moszumanska.debian.org
Wed Oct 25 15:59:03 UTC 2017


This is an automated email from the git hooks/post-receive script.

mckinstry pushed a commit to branch debian/master
in repository rest-gradle-plugin.

commit 1d488935d646721fa43dd58b68f18a7ba4c32f05
Author: noamt <noam at 10ne.org>
Date:   Wed Jun 26 09:32:10 2013 +0300

    Added support for preemptive authentication
---
 src/main/groovy/org/_10ne/gradle/rest/RestTask.groovy     | 2 +-
 src/test/groovy/org/_10ne/gradle/rest/RestTaskSpec.groovy | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/main/groovy/org/_10ne/gradle/rest/RestTask.groovy b/src/main/groovy/org/_10ne/gradle/rest/RestTask.groovy
index f5f76e9..c93bd19 100644
--- a/src/main/groovy/org/_10ne/gradle/rest/RestTask.groovy
+++ b/src/main/groovy/org/_10ne/gradle/rest/RestTask.groovy
@@ -62,7 +62,7 @@ class RestTask extends DefaultTask {
         client.uri = uri
         if (StringUtils.isNotBlank(username)) {
             if (preemptiveAuth) {
-                client.headers[HttpHeaders.AUTHORIZATION] = "$username:$password".toString().bytes.encodeBase64()
+                client.headers[HttpHeaders.AUTHORIZATION] = 'Basic ' + ("$username:$password".toString().bytes.encodeBase64())
             }
             client.auth.basic(username, password)
         }
diff --git a/src/test/groovy/org/_10ne/gradle/rest/RestTaskSpec.groovy b/src/test/groovy/org/_10ne/gradle/rest/RestTaskSpec.groovy
index 29d4a24..b2de4f6 100644
--- a/src/test/groovy/org/_10ne/gradle/rest/RestTaskSpec.groovy
+++ b/src/test/groovy/org/_10ne/gradle/rest/RestTaskSpec.groovy
@@ -91,7 +91,7 @@ class RestTaskSpec extends Specification {
         task.executeRequest()
 
         and:
-        headers[HttpHeaders.AUTHORIZATION] == 'dXNlcm5hbWU6cGFzc3dvcmQ='
+        headers[HttpHeaders.AUTHORIZATION] == 'Basic dXNlcm5hbWU6cGFzc3dvcmQ='
 
         then:
         1 * mockClient.setUri('bob.com')

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/rest-gradle-plugin.git



More information about the pkg-java-commits mailing list