You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by ma...@apache.org on 2025/06/06 01:43:15 UTC
(pulsar-client-go) 01/01: fix: support json token file format authentication
This is an automated email from the ASF dual-hosted git repository.
mattisonchao pushed a commit to branch fix.admin.tokenfile
in repository https://gitbox.apache.org/repos/asf/pulsar-client-go.git
commit 6a286978c7c62f2cdf6ebb167356c1ee0113ebe4
Author: Qiang Zhao <ma...@apache.org>
AuthorDate: Fri Jun 6 09:39:20 2025 +0800
fix: support json token file format authentication
---
pulsaradmin/pkg/admin/auth/token.go | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/pulsaradmin/pkg/admin/auth/token.go b/pulsaradmin/pkg/admin/auth/token.go
index ecf57ecc..8143dd07 100644
--- a/pulsaradmin/pkg/admin/auth/token.go
+++ b/pulsaradmin/pkg/admin/auth/token.go
@@ -36,6 +36,7 @@ const (
type Token struct {
Token string `json:"token"`
+ File string `json:"file"`
}
type TokenAuthProvider struct {
@@ -78,7 +79,13 @@ func NewAuthenticationTokenFromAuthParams(encodedAuthParam string,
tokenAuthProvider, err = NewAuthenticationToken(encodedAuthParam, transport)
}
} else {
- tokenAuthProvider, err = NewAuthenticationToken(tokenJSON.Token, transport)
+ if tokenJSON.File != "" {
+ tokenAuthProvider, err = NewAuthenticationTokenFromFile(tokenJSON.File, transport)
+ } else if tokenJSON.Token != "" {
+ tokenAuthProvider, err = NewAuthenticationToken(tokenJSON.Token, transport)
+ } else {
+ return nil, errors.New("unsupported token json auth param")
+ }
}
return tokenAuthProvider, err
}