Skip to content

Commit 990511e

Browse files
committed
Merge branch release/1.0.9 into master
Title: fix: Fix the error issue where the StsTokenCredential component in the credentials package does not exist. 本次代码评审的主要改动包括修复 `StsTokenCredential` 组件不存在的问题,更新版本号为 1.0.9,并升级依赖库 `github.com/aliyun/credentials-go` 到 v1.3.10。 Link: https://code.alibaba-inc.com/messaging/aliyun-mns-go-sdk/codereview/20791339
2 parents 7a75e9d + 01dae2e commit 990511e

File tree

7 files changed

+32
-8
lines changed

7 files changed

+32
-8
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Change log
22

3+
## 1.0.9
4+
- Fix the error [issue#26](https://github.com/aliyun/aliyun-mns-go-sdk/issues/26) where the StsTokenCredential component in the credentials package does not exist.
5+
36
## 1.0.8
47
- Support configuring the logEnable parameter for queues during creation and attribute setting.
58

README-CN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Aliyun MNS Go SDK
22

3-
[![Github version](https://badgen.net/badge/color/1.0.8/green?label=version)](https://badgen.net/badge/color/1.0.8/green?label=version)
3+
[![Github version](https://badgen.net/badge/color/1.0.9/green?label=version)](https://badgen.net/badge/color/1.0.9/green?label=version)
44

55
Aliyun MNS Go SDK 是 MNS 在 Go 编译语言的官方 SDK
66

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Aliyun MNS Go SDK
22

3-
[![Github version](https://badgen.net/badge/color/1.0.8/green?label=version)](https://badgen.net/badge/color/1.0.8/green?label=version)
3+
[![Github version](https://badgen.net/badge/color/1.0.9/green?label=version)](https://badgen.net/badge/color/1.0.9/green?label=version)
44

55
The Aliyun MNS Go SDK is the official SDK for MNS in the Go programming language
66

client.go

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,13 +143,29 @@ func NewAliMNSClientWithConfig(clientConfig AliMNSClientConfig) MNSClient {
143143
cli.Timeout = clientConfig.TimeoutSecond
144144
if clientConfig.Credential != nil {
145145
cli.credential = clientConfig.Credential
146+
} else if clientConfig.Token != "" {
147+
config := new(credentials.Config).
148+
SetType("sts").
149+
SetAccessKeyId(clientConfig.AccessKeyId).
150+
SetAccessKeySecret(clientConfig.AccessKeySecret).
151+
SetSecurityToken(clientConfig.Token)
152+
var err error
153+
cli.credential, err = credentials.NewCredential(config)
154+
if err != nil {
155+
panic(err)
156+
}
146157
} else {
147-
cli.credential = &credentials.StsTokenCredential{
148-
AccessKeyId: clientConfig.AccessKeyId,
149-
AccessKeySecret: clientConfig.AccessKeySecret,
150-
SecurityToken: clientConfig.Token,
158+
config := new(credentials.Config).
159+
SetType("access_key").
160+
SetAccessKeyId(clientConfig.AccessKeyId).
161+
SetAccessKeySecret(clientConfig.AccessKeySecret)
162+
var err error
163+
cli.credential, err = credentials.NewCredential(config)
164+
if err != nil {
165+
panic(err)
151166
}
152167
}
168+
153169
if clientConfig.MaxConnsPerHost != 0 {
154170
cli.MaxConnsPerHost = clientConfig.MaxConnsPerHost
155171
} else {

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/aliyun/aliyun-mns-go-sdk
33
go 1.20
44

55
require (
6-
github.com/aliyun/credentials-go v1.3.2
6+
github.com/aliyun/credentials-go v1.3.10
77
github.com/gogap/errors v0.0.0-20210818113853-edfbba0ddea9
88
github.com/gogap/logs v0.0.0-20150329044033-31c6d1e28b2c
99
github.com/valyala/fasthttp v1.52.0

go.sum

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ github.com/alibabacloud-go/tea v1.2.2 h1:aTsR6Rl3ANWPfqeQugPglfurloyBJY85eFy7Gc1
77
github.com/alibabacloud-go/tea v1.2.2/go.mod h1:CF3vOzEMAG+bR4WOql8gc2G9H3EkH3ZLAQdpmpXMgwk=
88
github.com/aliyun/credentials-go v1.3.2 h1:L4WppI9rctC8PdlMgyTkF8bBsy9pyKQEzBD1bHMRl+g=
99
github.com/aliyun/credentials-go v1.3.2/go.mod h1:tlpz4uys4Rn7Ik4/piGRrTbXy2uLKvePgQJJduE+Y5c=
10+
github.com/aliyun/credentials-go v1.3.9/go.mod h1:Jm6d+xIgwJVLVWT561vy67ZRP4lPTQxMbEYRuT2Ti1U=
11+
github.com/aliyun/credentials-go v1.3.10 h1:45Xxrae/evfzQL9V10zL3xX31eqgLWEaIdCoPipOEQA=
12+
github.com/aliyun/credentials-go v1.3.10/go.mod h1:Jm6d+xIgwJVLVWT561vy67ZRP4lPTQxMbEYRuT2Ti1U=
13+
github.com/aliyun/credentials-go v1.4.4/go.mod h1:Jm6d+xIgwJVLVWT561vy67ZRP4lPTQxMbEYRuT2Ti1U=
14+
github.com/aliyun/credentials-go v1.4.5/go.mod h1:Jm6d+xIgwJVLVWT561vy67ZRP4lPTQxMbEYRuT2Ti1U=
1015
github.com/andybalholm/brotli v1.1.0 h1:eLKJA0d02Lf0mVpIDgYnqXcUn0GqVmEFny3VuID1U3M=
1116
github.com/andybalholm/brotli v1.1.0/go.mod h1:sms7XGricyQI9K10gOSf56VKKWS4oLer58Q+mhRPtnY=
1217
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=

version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ package ali_mns
22

33
const (
44
SdkName = "aliyun-sdk-go"
5-
Version = "1.0.8"
5+
Version = "1.0.9"
66
)

0 commit comments

Comments
 (0)