You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by pe...@apache.org on 2020/08/03 02:16:22 UTC

[pulsar-client-go] branch master updated: Fix the keyfile unmarshal error (#339)

This is an automated email from the ASF dual-hosted git repository.

penghui pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar-client-go.git


The following commit(s) were added to refs/heads/master by this push:
     new 570d5ce  Fix the keyfile unmarshal error (#339)
570d5ce is described below

commit 570d5ceffa19958403d3bb4c8e38070e93ef8fab
Author: Yong Zhang <zh...@gmail.com>
AuthorDate: Mon Aug 3 10:16:13 2020 +0800

    Fix the keyfile unmarshal error (#339)
    
    ---
    
    *Motivation*
    
    Fix the keyfile unmarshal error:
    ```
    open test_credential.json: unsupported format
    ```
---
 oauth2/client_credentials_provider.go | 8 --------
 pulsar/client_impl_test.go            | 2 +-
 pulsar/internal/auth/oauth2_test.go   | 2 +-
 3 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/oauth2/client_credentials_provider.go b/oauth2/client_credentials_provider.go
index 2716376..731b399 100644
--- a/oauth2/client_credentials_provider.go
+++ b/oauth2/client_credentials_provider.go
@@ -19,14 +19,9 @@ package oauth2
 
 import (
 	"encoding/json"
-	"fmt"
 	"io/ioutil"
 )
 
-const (
-	KeyFileTypeServiceAccount = "sn_service_account"
-)
-
 type KeyFileProvider struct {
 	KeyFile string
 }
@@ -58,9 +53,6 @@ func (k *KeyFileProvider) GetClientCredentials() (*KeyFile, error) {
 	if err != nil {
 		return nil, err
 	}
-	if v.Type != KeyFileTypeServiceAccount {
-		return nil, fmt.Errorf("open %s: unsupported format", k.KeyFile)
-	}
 
 	return &v, nil
 }
diff --git a/pulsar/client_impl_test.go b/pulsar/client_impl_test.go
index 276e4fb..ba17219 100644
--- a/pulsar/client_impl_test.go
+++ b/pulsar/client_impl_test.go
@@ -266,7 +266,7 @@ func mockKeyFile(server string) (string, error) {
 		return "", err
 	}
 	_, err = kf.WriteString(fmt.Sprintf(`{
-  "type":"sn_service_account",
+  "type":"resource",
   "client_id":"client-id",
   "client_secret":"client-secret",
   "client_email":"oauth@test.org",
diff --git a/pulsar/internal/auth/oauth2_test.go b/pulsar/internal/auth/oauth2_test.go
index c8a4830..f1f9e07 100644
--- a/pulsar/internal/auth/oauth2_test.go
+++ b/pulsar/internal/auth/oauth2_test.go
@@ -69,7 +69,7 @@ func mockKeyFile(server string) (string, error) {
 		return "", err
 	}
 	_, err = kf.WriteString(fmt.Sprintf(`{
-  "type":"sn_service_account",
+  "type":"resource",
   "client_id":"client-id",
   "client_secret":"client-secret",
   "client_email":"oauth@test.org",