[ARVADOS] updated: aa5cf7406d0409f94bdb23cce72c354066dd3591

Git user git at public.curoverse.com
Wed Jun 28 16:00:57 EDT 2017


Summary of changes:
 sdk/go/auth/auth.go            |  2 +-
 sdk/go/auth/basic_auth_go13.go | 32 --------------------------------
 sdk/go/auth/basic_auth_go14.go | 15 ---------------
 sdk/go/auth/basic_auth_test.go | 34 ----------------------------------
 4 files changed, 1 insertion(+), 82 deletions(-)
 delete mode 100644 sdk/go/auth/basic_auth_go13.go
 delete mode 100644 sdk/go/auth/basic_auth_go14.go
 delete mode 100644 sdk/go/auth/basic_auth_test.go

       via  aa5cf7406d0409f94bdb23cce72c354066dd3591 (commit)
      from  40a318a791afb7494dfb052e254cd8bdff5a620f (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit aa5cf7406d0409f94bdb23cce72c354066dd3591
Author: Tom Clegg <tom at curoverse.com>
Date:   Wed Jun 28 15:38:36 2017 -0400

    2411: Remove golang<1.4 shim.
    
    Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom at curoverse.com>

diff --git a/sdk/go/auth/auth.go b/sdk/go/auth/auth.go
index 9c2a759..730989b 100644
--- a/sdk/go/auth/auth.go
+++ b/sdk/go/auth/auth.go
@@ -45,7 +45,7 @@ func (a *Credentials) LoadTokensFromHTTPRequest(r *http.Request) {
 
 	// Load base64-encoded token from "Authorization: Basic ..."
 	// header (typically used by git via credential helper)
-	if _, password, ok := BasicAuth(r); ok {
+	if _, password, ok := r.BasicAuth(); ok {
 		a.Tokens = append(a.Tokens, password)
 	}
 
diff --git a/sdk/go/auth/basic_auth_go13.go b/sdk/go/auth/basic_auth_go13.go
deleted file mode 100644
index 7108ded..0000000
--- a/sdk/go/auth/basic_auth_go13.go
+++ /dev/null
@@ -1,32 +0,0 @@
-// Copyright (C) The Arvados Authors. All rights reserved.
-//
-// SPDX-License-Identifier: Apache-2.0
-
-// +build !go1.4
-
-package auth
-
-import (
-	"encoding/base64"
-	"net/http"
-	"strings"
-)
-
-func BasicAuth(r *http.Request) (username, password string, ok bool) {
-	tokens := strings.SplitN(r.Header.Get("Authorization"), " ", 2)
-	if len(tokens) != 2 || tokens[0] != "Basic" {
-		return "", "", false
-	}
-
-	decoded, err := base64.StdEncoding.DecodeString(tokens[1])
-	if err != nil {
-		return "", "", false
-	}
-
-	userAndPass := strings.SplitN(string(decoded), ":", 2)
-	if len(userAndPass) != 2 {
-		return "", "", false
-	}
-
-	return userAndPass[0], userAndPass[1], true
-}
diff --git a/sdk/go/auth/basic_auth_go14.go b/sdk/go/auth/basic_auth_go14.go
deleted file mode 100644
index bfb430b..0000000
--- a/sdk/go/auth/basic_auth_go14.go
+++ /dev/null
@@ -1,15 +0,0 @@
-// Copyright (C) The Arvados Authors. All rights reserved.
-//
-// SPDX-License-Identifier: Apache-2.0
-
-// +build go1.4
-
-package auth
-
-import (
-	"net/http"
-)
-
-func BasicAuth(r *http.Request) (username, password string, ok bool) {
-	return r.BasicAuth()
-}
diff --git a/sdk/go/auth/basic_auth_test.go b/sdk/go/auth/basic_auth_test.go
deleted file mode 100644
index 83b737e..0000000
--- a/sdk/go/auth/basic_auth_test.go
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright (C) The Arvados Authors. All rights reserved.
-//
-// SPDX-License-Identifier: Apache-2.0
-
-package auth
-
-import (
-	"net/http"
-	"testing"
-)
-
-type basicAuthTestCase struct {
-	hdr  string
-	user string
-	pass string
-	ok   bool
-}
-
-func TestBasicAuth(t *testing.T) {
-	tests := []basicAuthTestCase{
-		{"Basic Zm9vOmJhcg==", "foo", "bar", true},
-		{"Bogus Zm9vOmJhcg==", "", "", false},
-		{"Zm9vOmJhcg==", "", "", false},
-		{"Basic", "", "", false},
-		{"", "", "", false},
-	}
-	for _, test := range tests {
-		if u, p, ok := BasicAuth(&http.Request{Header: map[string][]string{
-			"Authorization": {test.hdr},
-		}}); u != test.user || p != test.pass || ok != test.ok {
-			t.Error("got:", u, p, ok, "expected:", test.user, test.pass, test.ok, "from:", test.hdr)
-		}
-	}
-}

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list