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

mappjzc pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git


The following commit(s) were added to refs/heads/main by this push:
     new 215eb8bf5 fix(bamboo): change connection auth type (#4443)
215eb8bf5 is described below

commit 215eb8bf518f2b824b37bf132becb6ea71456903
Author: Warren Chen <[email protected]>
AuthorDate: Fri Feb 17 17:41:26 2023 +0800

    fix(bamboo): change connection auth type (#4443)
---
 backend/plugins/bamboo/models/connection.go                |  4 ++--
 .../models/migrationscripts/20230216_add_init_tables.go    |  2 +-
 .../bamboo/models/migrationscripts/archived/connection.go  | 14 +++++++-------
 3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/backend/plugins/bamboo/models/connection.go 
b/backend/plugins/bamboo/models/connection.go
index 87486dec1..3f66b5df9 100644
--- a/backend/plugins/bamboo/models/connection.go
+++ b/backend/plugins/bamboo/models/connection.go
@@ -37,13 +37,13 @@ type BambooConnection struct {
 type BambooConn struct {
        api.RestConnection `mapstructure:",squash"`
        //TODO you may need to use helper.BasicAuth instead of 
helper.AccessToken
-       api.AccessToken `mapstructure:",squash"`
+       api.BasicAuth `mapstructure:",squash"`
 }
 
 // PrepareApiClient test api and set the IsPrivateToken,version,UserId and so 
on.
 func (conn *BambooConn) PrepareApiClient(apiClient 
apihelperabstract.ApiClientAbstract) errors.Error {
        header := http.Header{}
-       header.Set("Authorization", fmt.Sprintf("Bearer %v", conn.Token))
+       header.Set("Authorization", fmt.Sprintf("Basic %v", 
conn.GetEncodedToken()))
 
        res, err := apiClient.Get("info.json", nil, header)
        if err != nil {
diff --git 
a/backend/plugins/bamboo/models/migrationscripts/20230216_add_init_tables.go 
b/backend/plugins/bamboo/models/migrationscripts/20230216_add_init_tables.go
index d43bd53b3..0a25a788d 100644
--- a/backend/plugins/bamboo/models/migrationscripts/20230216_add_init_tables.go
+++ b/backend/plugins/bamboo/models/migrationscripts/20230216_add_init_tables.go
@@ -34,7 +34,7 @@ func (u *addInitTables) Up(baseRes context.BasicRes) 
errors.Error {
 }
 
 func (*addInitTables) Version() uint64 {
-       return 20230216205024
+       return 20230216205025
 }
 
 func (*addInitTables) Name() string {
diff --git 
a/backend/plugins/bamboo/models/migrationscripts/archived/connection.go 
b/backend/plugins/bamboo/models/migrationscripts/archived/connection.go
index e99545ebe..e7e3d1ade 100644
--- a/backend/plugins/bamboo/models/migrationscripts/archived/connection.go
+++ b/backend/plugins/bamboo/models/migrationscripts/archived/connection.go
@@ -36,15 +36,15 @@ type RestConnection struct {
        RateLimitPerHour int    `comment:"api request rate limit per hour" 
json:"rateLimitPerHour"`
 }
 
-// AccessToken FIXME ...
-type AccessToken struct {
-       Token string `mapstructure:"token" validate:"required" json:"token" 
encrypt:"yes"`
+type BasicAuth struct {
+       Username string `mapstructure:"username" validate:"required" 
json:"username"`
+       Password string `mapstructure:"password" validate:"required" 
json:"password"`
 }
 
 type BambooConn struct {
        RestConnection `mapstructure:",squash"`
        //TODO you may need to use helper.BasicAuth instead of 
helper.AccessToken
-       AccessToken `mapstructure:",squash"`
+       BasicAuth `mapstructure:",squash"`
 }
 
 // TODO Please modify the following code to fit your needs
@@ -55,9 +55,9 @@ type BambooConnection struct {
 }
 
 type TestConnectionRequest struct {
-       Endpoint    string `json:"endpoint"`
-       Proxy       string `json:"proxy"`
-       AccessToken `mapstructure:",squash"`
+       Endpoint  string `json:"endpoint"`
+       Proxy     string `json:"proxy"`
+       BasicAuth `mapstructure:",squash"`
 }
 
 // This object conforms to what the frontend currently expects.

Reply via email to