Skip to content
Snippets Groups Projects
Commit 2210fef9 authored by Ooo0oO0o0oO's avatar Ooo0oO0o0oO
Browse files

fix comment issue

parent 71b63533
No related branches found
No related tags found
No related merge requests found
......@@ -5,11 +5,14 @@ import (
"testing"
)
import (
"github.com/stretchr/testify/assert"
)
import (
"github.com/apache/dubbo-go/common"
"github.com/apache/dubbo-go/common/constant"
invocation2 "github.com/apache/dubbo-go/protocol/invocation"
"github.com/stretchr/testify/assert"
)
func TestDefaultAccesskeyStorage_GetAccesskeyPair(t *testing.T) {
......
......@@ -69,7 +69,7 @@ func (authenticator *DefaultAuthenticator) Authenticate(invocation protocol.Invo
consumer := invocation.AttachmentsByKey(constant.CONSUMER, "")
if IsEmpty(accessKeyId, false) || IsEmpty(consumer, false) ||
IsEmpty(requestTimestamp, false) || IsEmpty(originSignature, false) {
return errors.New("failed to authenticate, maybe consumer not enable the auth")
return errors.New("failed to authenticate your ak/sk, maybe the consumer has not enabled the auth")
}
accessKeyPair, err := getAccessKeyPair(invocation, url)
......
......@@ -9,11 +9,14 @@ import (
"time"
)
import (
"github.com/stretchr/testify/assert"
)
import (
"github.com/apache/dubbo-go/common"
"github.com/apache/dubbo-go/common/constant"
"github.com/apache/dubbo-go/protocol/invocation"
"github.com/stretchr/testify/assert"
)
func TestDefaultAuthenticator_Authenticate(t *testing.T) {
......
......@@ -21,8 +21,8 @@ func init() {
func (filter *ConsumerSignFilter) Invoke(invoker protocol.Invoker, invocation protocol.Invocation) protocol.Result {
logger.Infof("invoking ConsumerSign filter.")
url := invoker.GetUrl()
shouldAuth := url.GetParamBool(constant.SERVICE_AUTH_KEY, false)
if shouldAuth {
shouldSign := url.GetParamBool(constant.SERVICE_AUTH_KEY, false)
if shouldSign {
authenticator := extension.GetAuthenticator(url.GetParam(constant.AUTHENTICATOR_KEY, constant.DEFAULT_AUTHENTICATOR))
if err := authenticator.Sign(invocation, &url); err != nil {
panic(fmt.Sprintf("Sign for invocation %s # %s failed", url.ServiceKey(), invocation.MethodName()))
......
......@@ -5,14 +5,17 @@ import (
"testing"
)
import (
"github.com/golang/mock/gomock"
"github.com/stretchr/testify/assert"
)
import (
"github.com/apache/dubbo-go/common"
"github.com/apache/dubbo-go/common/constant"
"github.com/apache/dubbo-go/protocol"
"github.com/apache/dubbo-go/protocol/invocation"
"github.com/apache/dubbo-go/protocol/mock"
"github.com/golang/mock/gomock"
"github.com/stretchr/testify/assert"
)
func TestConsumerSignFilter_Invoke(t *testing.T) {
......
......@@ -6,14 +6,18 @@ import (
"testing"
"time"
)
import (
"github.com/golang/mock/gomock"
"github.com/stretchr/testify/assert"
)
import (
"github.com/apache/dubbo-go/common"
"github.com/apache/dubbo-go/common/constant"
"github.com/apache/dubbo-go/protocol"
"github.com/apache/dubbo-go/protocol/invocation"
"github.com/apache/dubbo-go/protocol/mock"
"github.com/golang/mock/gomock"
"github.com/stretchr/testify/assert"
)
func TestProviderAuthFilter_Invoke(t *testing.T) {
......
......@@ -47,9 +47,7 @@ func IsEmpty(s string, allowSpace bool) bool {
return true
}
if !allowSpace {
if strings.TrimSpace(s) == "" {
return true
}
return strings.TrimSpace(s) == ""
}
return false
}
......@@ -3,6 +3,7 @@ package auth
import (
"testing"
)
import (
"github.com/stretchr/testify/assert"
)
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment