summaryrefslogtreecommitdiff
path: root/edge
diff options
context:
space:
mode:
authorXuJiejie <406347136@qq.com>2020-05-07 18:17:41 +0800
committerXuJiejie <406347136@qq.com>2020-05-07 18:17:41 +0800
commit26dc5aa810eae1c93195696d529adea112591948 (patch)
treed2cf6387a041766768eb63b543200e321616e54f /edge
parentchange the token separator space to dot (diff)
downloadkubeedge-26dc5aa810eae1c93195696d529adea112591948.tar.gz
modify the code about the parsing token
Diffstat (limited to 'edge')
-rw-r--r--edge/pkg/edgehub/process.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/edge/pkg/edgehub/process.go b/edge/pkg/edgehub/process.go
index 7398c9771..64a2234cf 100644
--- a/edge/pkg/edgehub/process.go
+++ b/edge/pkg/edgehub/process.go
@@ -44,7 +44,7 @@ func (eh *EdgeHub) applyCerts() error {
// validate the CA certificate by hashcode
tokenParts := strings.Split(config.Config.Token, ".")
- if len(tokenParts) != 2 {
+ if len(tokenParts) != 4 {
return fmt.Errorf("token credentials are in the wrong format")
}
ok, hash, newHash := certutil.ValidateCACerts(cacert, tokenParts[0])
@@ -66,7 +66,7 @@ func (eh *EdgeHub) applyCerts() error {
// get the edge.crt
url = config.Config.HTTPServer + certURL
- edgecert, err := certutil.GetEdgeCert(url, cacert, tokenParts[1])
+ edgecert, err := certutil.GetEdgeCert(url, cacert, strings.Join(tokenParts[1:], "."))
if err != nil {
klog.Errorf("failed to get edge certificate from the cloudcore, error: %v", err)
return fmt.Errorf("failed to get edge certificate from the cloudcore, error: %v", err)