Skip to content
Snippets Groups Projects
Commit 16e49e63 authored by Ooo0oO0o0oO's avatar Ooo0oO0o0oO
Browse files

add some comments

parent c2158c4e
Branches
Tags
No related merge requests found
......@@ -14,6 +14,8 @@ type AccessKeyPair struct {
Options string `yaml:"options" json:"options,omitempty" property:"options"`
}
// This SPI Extension support us to store our AccessKeyPair or load AccessKeyPair from other
// storage, such as filesystem.
type AccessKeyStorage interface {
GetAccessKeyPair(protocol.Invocation, *common.URL) *AccessKeyPair
}
......@@ -6,6 +6,10 @@ import (
)
type Authenticator interface {
// give a sign to request
Sign(protocol.Invocation, *common.URL) error
// verify the signature of the request is valid or not
Authenticate(protocol.Invocation, *common.URL) error
}
......@@ -8,9 +8,11 @@ import (
"github.com/apache/dubbo-go/protocol"
)
// The default implementation of AccesskeyStorage
type DefaultAccesskeyStorage struct {
}
// get AccessKeyPair from url by the key "accessKeyId" and "secretAccessKey"
func (storage *DefaultAccesskeyStorage) GetAccessKeyPair(invocation protocol.Invocation, url *common.URL) *filter.AccessKeyPair {
return &filter.AccessKeyPair{
AccessKey: url.GetParam(constant.ACCESS_KEY_ID_KEY, ""),
......
......@@ -12,6 +12,7 @@ import (
"github.com/apache/dubbo-go/protocol"
)
// This filter is working for signing the request on consumer side
type ConsumerSignFilter struct {
}
......
......@@ -20,6 +20,7 @@ func init() {
extension.SetAuthenticator(constant.DEFAULT_AUTHENTICATOR, GetDefaultAuthenticator)
}
// The default implemetation of Authenticator
type DefaultAuthenticator struct {
}
......
......@@ -9,6 +9,7 @@ import (
"github.com/apache/dubbo-go/protocol"
)
// This filter is used to verify the correctness of the signature on provider side
type ProviderAuthFilter struct {
}
......
......@@ -9,6 +9,7 @@ import (
"strings"
)
// get a signature string with given information, such as metadata or parameters
func Sign(metadata, key string) string {
return doSign([]byte(metadata), key)
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment