You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by ti...@apache.org on 2020/07/01 02:01:43 UTC

[servicecomb-service-center] branch master updated: add more action for code quality (#657)

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

tianxiaoliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-service-center.git


The following commit(s) were added to refs/heads/master by this push:
     new 9282639  add more action for code quality (#657)
9282639 is described below

commit 928263929ccb2a0f3135040963782f6f363497b7
Author: Shawn <xi...@gmail.com>
AuthorDate: Wed Jul 1 10:01:34 2020 +0800

    add more action for code quality (#657)
---
 .github/workflows/bench.yaml                       | 17 +++++++
 .github/workflows/reviewdog.yml                    | 30 ++++++++++++
 .travis.yml                                        | 35 --------------
 pkg/etcdsync/mutex_test.go                         |  2 +-
 server/bootstrap/bootstrap.go                      |  2 +-
 server/plugin/auth/auth.go                         |  7 ++-
 .../auth/buildin/buidlin_test.go}                  | 56 ++++++++++++++--------
 server/plugin/auth/buildin/buildin.go              | 19 ++++----
 server/plugin/common.go                            |  2 +-
 server/plugin/discovery/aggregate/adaptor.go       |  2 +-
 server/plugin/discovery/aggregate/repo.go          |  2 +-
 server/plugin/discovery/etcd/repo.go               |  2 +-
 server/plugin/discovery/k8s/repo.go                |  2 +-
 server/plugin/discovery/servicecenter/repo.go      |  2 +-
 server/plugin/export.go                            | 22 ++++-----
 server/plugin/plugin.go                            | 52 ++++++++++----------
 server/plugin/plugin_test.go                       |  8 ++--
 server/plugin/quota/buildin/buildin.go             |  2 +-
 server/plugin/quota/unlimit/unlimit.go             |  2 +-
 server/plugin/registry/buildin/buildin.go          |  2 +-
 server/plugin/registry/embededetcd/embededetcd.go  |  2 +-
 server/plugin/registry/etcd/etcd.go                |  2 +-
 server/plugin/registry/etcd/etcd_test.go           |  2 +-
 server/plugin/security/buildin/buildin.go          |  2 +-
 server/plugin/tls/buildin/buildin.go               |  2 +-
 .../plugin/tracing/{buildin => pzipkin}/buildin.go |  4 +-
 .../tracing/{buildin => pzipkin}/buildin_test.go   |  2 +-
 .../plugin/tracing/{buildin => pzipkin}/common.go  |  2 +-
 .../tracing/{buildin => pzipkin}/common_test.go    |  2 +-
 .../tracing/{buildin => pzipkin}/file_collector.go |  2 +-
 .../{buildin => pzipkin}/file_collector_test.go    |  2 +-
 server/plugin/tracing/{buildin => pzipkin}/span.go |  2 +-
 .../tracing/{buildin => pzipkin}/span_test.go      |  2 +-
 server/plugin/types.go                             | 28 +++++------
 server/plugin/uuid/buildin/buildin.go              |  2 +-
 server/plugin/uuid/context/context.go              |  2 +-
 server/service/kv/store_test.go                    |  4 +-
 server/service/rbac/dao/account_dao_test.go        |  4 +-
 server/service/rbac/rbac.go                        | 10 ++++
 server/service/rbac/rbca_test.go                   |  4 +-
 40 files changed, 194 insertions(+), 156 deletions(-)

diff --git a/.github/workflows/bench.yaml b/.github/workflows/bench.yaml
new file mode 100644
index 0000000..d20c921
--- /dev/null
+++ b/.github/workflows/bench.yaml
@@ -0,0 +1,17 @@
+name: gobenchdata publish
+on: push
+jobs:
+  publish:
+    runs-on: ubuntu-latest
+    steps:
+      - name: checkout
+        uses: actions/checkout@v2
+      - name: gobenchdata publish
+        uses: bobheadxi/gobenchdata@v1
+        with:
+          PRUNE_COUNT: 30
+          GO_TEST_FLAGS: -cpu 1,2
+          PUBLISH: true
+          PUBLISH_BRANCH: gh-pages
+        env:
+          GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
\ No newline at end of file
diff --git a/.github/workflows/reviewdog.yml b/.github/workflows/reviewdog.yml
new file mode 100644
index 0000000..da26b99
--- /dev/null
+++ b/.github/workflows/reviewdog.yml
@@ -0,0 +1,30 @@
+name: reviewdog
+on: [pull_request]
+jobs:
+  # Use golint via golangci-lint binary with "warning" level.
+  golint:
+    name: runner / golint
+    runs-on: ubuntu-latest
+    steps:
+      - name: Check out code into the Go module directory
+        uses: actions/checkout@v1
+      - name: golint
+        uses: reviewdog/action-golangci-lint@v1
+        with:
+          golangci_lint_flags: "--disable-all -E golint"
+          tool_name: golint # Change reporter name.
+          level: warning # GitHub Status Check won't become failure with this level.
+
+  # You can add more and more supported linters with different config.
+  errcheck:
+    name: runner / errcheck
+    runs-on: ubuntu-latest
+    steps:
+      - name: Check out code into the Go module directory
+        uses: actions/checkout@v1
+      - name: errcheck
+        uses: reviewdog/action-golangci-lint@v1
+        with:
+          golangci_lint_flags: "--disable-all -E errcheck"
+          tool_name: errcheck
+          level: info
\ No newline at end of file
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 54480fd..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1,35 +0,0 @@
-language: go
-
-sudo: required
-
-services:
-  - docker
-
-go:
-  - 1.14
-
-before_install:
-  - go get github.com/mattn/goveralls
-  - curl -sL https://deb.nodesource.com/setup_8.x | sudo bash -
-  - sudo apt-get install -y nodejs
-  - npm install -g bower
-
-before_script:
-  - mkdir -p $HOME/gopath/src/github.com/apache/servicecomb-service-center
-  - rsync -az ${TRAVIS_BUILD_DIR}/ $HOME/gopath/src/github.com/apache/servicecomb-service-center/
-  - export TRAVIS_BUILD_DIR=$HOME/gopath/src/github.com/apache/servicecomb-service-center
-  - cd $HOME/gopath/src/github.com/apache/servicecomb-service-center
-  - GO111MODULE=on go mod download
-  - GO111MODULE=on go mod vendor
-  
-install: true
-
-jobs:
-  include:
-    - stage: Unit Testing
-      script: bash -x scripts/ut_test_in_docker.sh && $HOME/gopath/bin/goveralls -coverprofile=coverage.txt -service=travis-ci
-    - stage: Integration Testing
-      script: bash -x scripts/integration_test.sh
-
-after_success:
-  - bash <(curl -s https://codecov.io/bash)
diff --git a/pkg/etcdsync/mutex_test.go b/pkg/etcdsync/mutex_test.go
index 011ceed..0e9e125 100644
--- a/pkg/etcdsync/mutex_test.go
+++ b/pkg/etcdsync/mutex_test.go
@@ -24,7 +24,7 @@ import (
 	"testing"
 
 	_ "github.com/apache/servicecomb-service-center/server/plugin/registry/etcd"
-	_ "github.com/apache/servicecomb-service-center/server/plugin/tracing/buildin"
+	_ "github.com/apache/servicecomb-service-center/server/plugin/tracing/pzipkin"
 )
 
 func init() {
diff --git a/server/bootstrap/bootstrap.go b/server/bootstrap/bootstrap.go
index 991f8f8..cbff156 100644
--- a/server/bootstrap/bootstrap.go
+++ b/server/bootstrap/bootstrap.go
@@ -46,7 +46,7 @@ import _ "github.com/apache/servicecomb-service-center/server/plugin/uuid/buildi
 import _ "github.com/apache/servicecomb-service-center/server/plugin/uuid/context"
 
 // tracing
-import _ "github.com/apache/servicecomb-service-center/server/plugin/tracing/buildin"
+import _ "github.com/apache/servicecomb-service-center/server/plugin/tracing/pzipkin"
 
 // tls
 import _ "github.com/apache/servicecomb-service-center/server/plugin/tls/buildin"
diff --git a/server/plugin/auth/auth.go b/server/plugin/auth/auth.go
index fe8c030..7632600 100644
--- a/server/plugin/auth/auth.go
+++ b/server/plugin/auth/auth.go
@@ -16,7 +16,12 @@
  */
 package auth
 
-import "net/http"
+import (
+	"errors"
+	"net/http"
+)
+
+var ErrNoHeader = errors.New("should provide Authorization header")
 
 type Auth interface {
 	Identify(r *http.Request) error
diff --git a/server/service/kv/store_test.go b/server/plugin/auth/buildin/buidlin_test.go
similarity index 53%
copy from server/service/kv/store_test.go
copy to server/plugin/auth/buildin/buidlin_test.go
index 493e97f..e86761e 100644
--- a/server/service/kv/store_test.go
+++ b/server/plugin/auth/buildin/buidlin_test.go
@@ -15,48 +15,62 @@
  * limitations under the License.
  */
 
-package kv_test
+package buildin_test
 
 import (
-	"context"
 	mgr "github.com/apache/servicecomb-service-center/server/plugin"
+	"github.com/apache/servicecomb-service-center/server/plugin/auth"
+	"github.com/apache/servicecomb-service-center/server/plugin/auth/buildin"
 	"github.com/apache/servicecomb-service-center/server/plugin/discovery/etcd"
 	etcd2 "github.com/apache/servicecomb-service-center/server/plugin/registry/etcd"
-	"github.com/apache/servicecomb-service-center/server/plugin/tracing/buildin"
-	"github.com/apache/servicecomb-service-center/server/service/kv"
+	plain "github.com/apache/servicecomb-service-center/server/plugin/security/buildin"
+	"github.com/apache/servicecomb-service-center/server/plugin/tracing/pzipkin"
+	"github.com/apache/servicecomb-service-center/server/service/rbac"
 	"github.com/astaxie/beego"
+	"github.com/go-chassis/go-archaius"
+	"github.com/go-chassis/go-chassis/security/secret"
 	"github.com/stretchr/testify/assert"
+	"io/ioutil"
+	"net/http"
+	"net/http/httptest"
 	"testing"
 )
 
 func init() {
 	beego.AppConfig.Set("registry_plugin", "etcd")
+	beego.AppConfig.Set("rbac_enabled", "true")
+	beego.AppConfig.Set(rbac.PubFilePath, "./rbac.pub")
+	beego.AppConfig.Set("rbac_rsa_private_key_file", "./private.key")
 	mgr.RegisterPlugin(mgr.Plugin{mgr.REGISTRY, "etcd", etcd2.NewRegistry})
 	mgr.RegisterPlugin(mgr.Plugin{mgr.DISCOVERY, "buildin", etcd.NewRepository})
 	mgr.RegisterPlugin(mgr.Plugin{mgr.DISCOVERY, "etcd", etcd.NewRepository})
-	mgr.RegisterPlugin(mgr.Plugin{mgr.TRACING, "buildin", buildin.New})
+	mgr.RegisterPlugin(mgr.Plugin{mgr.CIPHER, "buildin", plain.New})
+	mgr.RegisterPlugin(mgr.Plugin{mgr.TRACING, "buildin", pzipkin.New})
 
 }
-func TestStoreData(t *testing.T) {
-
-	t.Run("put, get string", func(t *testing.T) {
-		err := kv.Put(context.Background(), "test", "value")
-		assert.NoError(t, err)
-		r, err := kv.Get(context.Background(), "test")
+func TestTokenAuthenticator_Identify(t *testing.T) {
+	t.Run("init rbac", func(t *testing.T) {
+		err := archaius.Init(archaius.WithMemorySource(), archaius.WithENVSource())
 		assert.NoError(t, err)
-		assert.Equal(t, "value", string(r.Value))
-	})
-	t.Run("should exist", func(t *testing.T) {
-		b, err := kv.Exist(context.Background(), "test")
+
+		pri, pub, err := secret.GenRSAKeyPair(4096)
 		assert.NoError(t, err)
-		assert.True(t, b)
-	})
 
-	t.Run("put, get bytes", func(t *testing.T) {
-		err := kv.PutBytes(context.Background(), "test", []byte(`value`))
+		b, err := secret.RSAPrivate2Bytes(pri)
 		assert.NoError(t, err)
-		r, err := kv.Get(context.Background(), "test")
+		ioutil.WriteFile("./private.key", b, 0600)
+		b, err = secret.RSAPublicKey2Bytes(pub)
+		err = ioutil.WriteFile("./rbac.pub", b, 0600)
 		assert.NoError(t, err)
-		assert.Equal(t, "value", string(r.Value))
+
+		archaius.Set(rbac.InitPassword, "root")
+
+		rbac.Init()
 	})
+	a := buildin.New()
+	ta := a.(*buildin.TokenAuthenticator)
+	r := httptest.NewRequest(http.MethodGet, "/any", nil)
+	err := ta.Identify(r)
+	t.Log(err)
+	assert.Equal(t, auth.ErrNoHeader, err)
 }
diff --git a/server/plugin/auth/buildin/buildin.go b/server/plugin/auth/buildin/buildin.go
index bd28f61..901715e 100644
--- a/server/plugin/auth/buildin/buildin.go
+++ b/server/plugin/auth/buildin/buildin.go
@@ -21,6 +21,7 @@ import (
 	"errors"
 	"github.com/apache/servicecomb-service-center/pkg/log"
 	mgr "github.com/apache/servicecomb-service-center/server/plugin"
+	"github.com/apache/servicecomb-service-center/server/plugin/auth"
 	"github.com/apache/servicecomb-service-center/server/service/rbac"
 	"github.com/go-chassis/go-chassis/security/authr"
 	"github.com/go-chassis/go-chassis/server/restful"
@@ -29,10 +30,10 @@ import (
 )
 
 func init() {
-	mgr.RegisterPlugin(mgr.Plugin{mgr.AUTH, "buildin", New})
+	mgr.RegisterPlugin(mgr.Plugin{PName: mgr.AUTH, Name: "buildin", New: New})
 }
 
-func New() mgr.PluginInstance {
+func New() mgr.Instance {
 	return &TokenAuthenticator{}
 }
 
@@ -49,7 +50,7 @@ func (ba *TokenAuthenticator) Identify(req *http.Request) error {
 
 	v := req.Header.Get(restful.HeaderAuth)
 	if v == "" {
-		return errors.New("should provide token in header")
+		return auth.ErrNoHeader
 	}
 	s := strings.Split(v, " ")
 	if len(s) != 2 {
@@ -68,14 +69,10 @@ func (ba *TokenAuthenticator) Identify(req *http.Request) error {
 	return nil
 }
 func mustAuth(req *http.Request) bool {
-	if strings.Contains(req.URL.Path, "/v4/token") {
-		return false
-	}
-	if strings.Contains(req.URL.Path, "/health") {
-		return false
-	}
-	if strings.Contains(req.URL.Path, "/version") {
-		return false
+	for v := range rbac.WhiteAPIList() {
+		if strings.Contains(req.URL.Path, v) {
+			return false
+		}
 	}
 	return true
 }
diff --git a/server/plugin/common.go b/server/plugin/common.go
index b85aa6b..d23a3c4 100644
--- a/server/plugin/common.go
+++ b/server/plugin/common.go
@@ -29,7 +29,7 @@ const (
 )
 
 // DynamicPluginFunc should be called in buildin implement
-func DynamicPluginFunc(pn PluginName, funcName string) pg.Symbol {
+func DynamicPluginFunc(pn Name, funcName string) pg.Symbol {
 	if wi, ok := Plugins().instances[pn]; ok && !wi.dynamic {
 		return nil
 	}
diff --git a/server/plugin/discovery/aggregate/adaptor.go b/server/plugin/discovery/aggregate/adaptor.go
index 44b3b2c..6f158c3 100644
--- a/server/plugin/discovery/aggregate/adaptor.go
+++ b/server/plugin/discovery/aggregate/adaptor.go
@@ -88,7 +88,7 @@ func getLogConflictFunc(t discovery.Type) func(origin, conflict *discovery.KeyVa
 func NewAggregator(t discovery.Type, cfg *discovery.Config) *Aggregator {
 	as := &Aggregator{Type: t}
 	for _, name := range repos {
-		repo := mgr.Plugins().Get(mgr.DISCOVERY, mgr.PluginImplName(name)).New().(discovery.AdaptorRepository)
+		repo := mgr.Plugins().Get(mgr.DISCOVERY, mgr.ImplName(name)).New().(discovery.AdaptorRepository)
 		as.Adaptors = append(as.Adaptors, repo.New(t, cfg))
 	}
 	as.Indexer = NewAggregatorIndexer(as)
diff --git a/server/plugin/discovery/aggregate/repo.go b/server/plugin/discovery/aggregate/repo.go
index 6d772f8..0a8b5bd 100644
--- a/server/plugin/discovery/aggregate/repo.go
+++ b/server/plugin/discovery/aggregate/repo.go
@@ -32,7 +32,7 @@ func (r *AggregateRepository) New(t discovery.Type, cfg *discovery.Config) disco
 	return NewAggregator(t, cfg)
 }
 
-func NewRepository() mgr.PluginInstance {
+func NewRepository() mgr.Instance {
 	InitConfigs()
 	return &AggregateRepository{}
 }
diff --git a/server/plugin/discovery/etcd/repo.go b/server/plugin/discovery/etcd/repo.go
index a1ce66c..90a03e8 100644
--- a/server/plugin/discovery/etcd/repo.go
+++ b/server/plugin/discovery/etcd/repo.go
@@ -33,7 +33,7 @@ func (r *EtcdRepository) New(t discovery.Type, cfg *discovery.Config) discovery.
 	return NewEtcdAdaptor(t.String(), cfg)
 }
 
-func NewRepository() mgr.PluginInstance {
+func NewRepository() mgr.Instance {
 	InitConfigs()
 	return &EtcdRepository{}
 }
diff --git a/server/plugin/discovery/k8s/repo.go b/server/plugin/discovery/k8s/repo.go
index 493df21..699911e 100644
--- a/server/plugin/discovery/k8s/repo.go
+++ b/server/plugin/discovery/k8s/repo.go
@@ -34,6 +34,6 @@ func (r *K8sRepository) New(t discovery.Type, cfg *discovery.Config) discovery.A
 	return adaptor.NewK8sAdaptor(t, cfg)
 }
 
-func NewRepository() mgr.PluginInstance {
+func NewRepository() mgr.Instance {
 	return &K8sRepository{}
 }
diff --git a/server/plugin/discovery/servicecenter/repo.go b/server/plugin/discovery/servicecenter/repo.go
index eb2569f..c78f5db 100644
--- a/server/plugin/discovery/servicecenter/repo.go
+++ b/server/plugin/discovery/servicecenter/repo.go
@@ -32,7 +32,7 @@ func (r *ServiceCenterRepository) New(t discovery.Type, cfg *discovery.Config) d
 	return NewServiceCenterAdaptor(t, cfg)
 }
 
-func NewRepository() mgr.PluginInstance {
+func NewRepository() mgr.Instance {
 	InitConfigs()
 	return &ServiceCenterRepository{}
 }
diff --git a/server/plugin/export.go b/server/plugin/export.go
index 458d003..8e0831e 100644
--- a/server/plugin/export.go
+++ b/server/plugin/export.go
@@ -28,7 +28,7 @@ import (
 )
 
 const (
-	UUID PluginName = iota
+	UUID Name = iota
 	AUDIT_LOG
 	AUTH
 	CIPHER
@@ -40,7 +40,7 @@ const (
 	typeEnd // for counting
 )
 
-var pluginNames = map[PluginName]string{
+var pluginNames = map[Name]string{
 	UUID:      "uuid",
 	AUDIT_LOG: "auditlog",
 	AUTH:      "auth",
@@ -52,18 +52,18 @@ var pluginNames = map[PluginName]string{
 	TLS:       "ssl",
 }
 
-func (pm *PluginManager) Discovery() discovery.AdaptorRepository {
+func (pm *Manager) Discovery() discovery.AdaptorRepository {
 	return pm.Instance(DISCOVERY).(discovery.AdaptorRepository)
 }
-func (pm *PluginManager) Registry() registry.Registry {
+func (pm *Manager) Registry() registry.Registry {
 	return pm.Instance(REGISTRY).(registry.Registry)
 }
-func (pm *PluginManager) UUID() uuid.UUID { return pm.Instance(UUID).(uuid.UUID) }
-func (pm *PluginManager) AuditLog() auditlog.AuditLogger {
+func (pm *Manager) UUID() uuid.UUID { return pm.Instance(UUID).(uuid.UUID) }
+func (pm *Manager) AuditLog() auditlog.AuditLogger {
 	return pm.Instance(AUDIT_LOG).(auditlog.AuditLogger)
 }
-func (pm *PluginManager) Auth() auth.Auth              { return pm.Instance(AUTH).(auth.Auth) }
-func (pm *PluginManager) Cipher() security.Cipher      { return pm.Instance(CIPHER).(security.Cipher) }
-func (pm *PluginManager) Quota() quota.QuotaManager    { return pm.Instance(QUOTA).(quota.QuotaManager) }
-func (pm *PluginManager) Tracing() (v tracing.Tracing) { return pm.Instance(TRACING).(tracing.Tracing) }
-func (pm *PluginManager) TLS() tls.TLS                 { return pm.Instance(TLS).(tls.TLS) }
+func (pm *Manager) Auth() auth.Auth              { return pm.Instance(AUTH).(auth.Auth) }
+func (pm *Manager) Cipher() security.Cipher      { return pm.Instance(CIPHER).(security.Cipher) }
+func (pm *Manager) Quota() quota.QuotaManager    { return pm.Instance(QUOTA).(quota.QuotaManager) }
+func (pm *Manager) Tracing() (v tracing.Tracing) { return pm.Instance(TRACING).(tracing.Tracing) }
+func (pm *Manager) TLS() tls.TLS                 { return pm.Instance(TLS).(tls.TLS) }
diff --git a/server/plugin/plugin.go b/server/plugin/plugin.go
index e4027c5..f7d28dc 100644
--- a/server/plugin/plugin.go
+++ b/server/plugin/plugin.go
@@ -26,7 +26,7 @@ import (
 	"github.com/astaxie/beego"
 )
 
-var pluginMgr = &PluginManager{}
+var pluginMgr = &Manager{}
 
 func init() {
 	pluginMgr.Initialize()
@@ -34,30 +34,30 @@ func init() {
 
 type wrapInstance struct {
 	dynamic  bool
-	instance PluginInstance
+	instance Instance
 	lock     sync.RWMutex
 }
 
-// PluginManager manages plugin instance generation.
-// PluginManager keeps the plugin instance currently used by server
+// Manager manages plugin instance generation.
+// Manager keeps the plugin instance currently used by server
 // for every plugin interface.
-type PluginManager struct {
-	plugins   map[PluginName]map[PluginImplName]*Plugin
-	instances map[PluginName]*wrapInstance
+type Manager struct {
+	plugins   map[Name]map[ImplName]*Plugin
+	instances map[Name]*wrapInstance
 }
 
 // Initialize initializes the struct
-func (pm *PluginManager) Initialize() {
-	pm.plugins = make(map[PluginName]map[PluginImplName]*Plugin, int(typeEnd))
-	pm.instances = make(map[PluginName]*wrapInstance, int(typeEnd))
+func (pm *Manager) Initialize() {
+	pm.plugins = make(map[Name]map[ImplName]*Plugin, int(typeEnd))
+	pm.instances = make(map[Name]*wrapInstance, int(typeEnd))
 
-	for t := PluginName(0); t != typeEnd; t++ {
+	for t := Name(0); t != typeEnd; t++ {
 		pm.instances[t] = &wrapInstance{}
 	}
 }
 
 // ReloadAll reloads all the plugin instances
-func (pm *PluginManager) ReloadAll() {
+func (pm *Manager) ReloadAll() {
 	for pn := range pm.instances {
 		pm.Reload(pn)
 	}
@@ -65,10 +65,10 @@ func (pm *PluginManager) ReloadAll() {
 
 // Register registers a 'Plugin'
 // unsafe
-func (pm *PluginManager) Register(p Plugin) {
+func (pm *Manager) Register(p Plugin) {
 	m, ok := pm.plugins[p.PName]
 	if !ok {
-		m = make(map[PluginImplName]*Plugin, 5)
+		m = make(map[ImplName]*Plugin, 5)
 	}
 	m[p.Name] = &p
 	pm.plugins[p.PName] = m
@@ -76,7 +76,7 @@ func (pm *PluginManager) Register(p Plugin) {
 }
 
 // Get gets a 'Plugin'
-func (pm *PluginManager) Get(pn PluginName, name PluginImplName) *Plugin {
+func (pm *Manager) Get(pn Name, name ImplName) *Plugin {
 	m, ok := pm.plugins[pn]
 	if !ok {
 		return nil
@@ -88,16 +88,16 @@ func (pm *PluginManager) Get(pn PluginName, name PluginImplName) *Plugin {
 // What plugin instance you get is depended on the supplied go plugin files
 // (high priority) or the plugin config(low priority)
 //
-// The go plugin file should be {plugins_dir}/{PluginName}_plugin.so.
+// The go plugin file should be {plugins_dir}/{Name}_plugin.so.
 // ('plugins_dir' must be configured as a valid path in service-center config.)
 // The plugin config in service-center config should be:
-// {PluginName}_plugin = {PluginImplName}
+// {Name}_plugin = {ImplName}
 //
 // e.g. For registry plugin, you can set a config in app.conf:
 // plugins_dir = /home, and supply a go plugin file: /home/registry_plugin.so;
 // or if you want to use etcd as registry, you can set a config in app.conf:
 // registry_plugin = etcd.
-func (pm *PluginManager) Instance(pn PluginName) PluginInstance {
+func (pm *Manager) Instance(pn Name) Instance {
 	wi := pm.instances[pn]
 	wi.lock.RLock()
 	if wi.instance != nil {
@@ -121,10 +121,10 @@ func (pm *PluginManager) Instance(pn PluginName) PluginInstance {
 // but not returns it.
 // Use 'Instance' if you want to get the plugin instance.
 // We suggest you to use 'Instance' instead of 'New'.
-func (pm *PluginManager) New(pn PluginName) {
+func (pm *Manager) New(pn Name) {
 	var (
 		title = STATIC
-		f     func() PluginInstance
+		f     func() Instance
 	)
 
 	wi := pm.instances[pn]
@@ -142,7 +142,7 @@ func (pm *PluginManager) New(pn PluginName) {
 		}
 
 		name := beego.AppConfig.DefaultString(pn.String()+"_plugin", BUILDIN)
-		p, ok = m[PluginImplName(name)]
+		p, ok = m[ImplName(name)]
 		if !ok {
 			return
 		}
@@ -157,7 +157,7 @@ func (pm *PluginManager) New(pn PluginName) {
 }
 
 // Reload reloads the instance of the specified plugin interface.
-func (pm *PluginManager) Reload(pn PluginName) {
+func (pm *Manager) Reload(pn Name) {
 	wi := pm.instances[pn]
 	wi.lock.Lock()
 	wi.instance = nil
@@ -165,7 +165,7 @@ func (pm *PluginManager) Reload(pn PluginName) {
 	wi.lock.Unlock()
 }
 
-func (pm *PluginManager) existDynamicPlugin(pn PluginName) *Plugin {
+func (pm *Manager) existDynamicPlugin(pn Name) *Plugin {
 	m, ok := pm.plugins[pn]
 	if !ok {
 		return nil
@@ -177,8 +177,8 @@ func (pm *PluginManager) existDynamicPlugin(pn PluginName) *Plugin {
 	return nil
 }
 
-// Plugins returns the 'PluginManager'.
-func Plugins() *PluginManager {
+// Plugins returns the 'Manager'.
+func Plugins() *Manager {
 	return pluginMgr
 }
 
@@ -189,7 +189,7 @@ func RegisterPlugin(p Plugin) {
 
 // LoadPlugins loads and sets all the plugin interfaces's instance.
 func LoadPlugins() {
-	for t := PluginName(0); t != typeEnd; t++ {
+	for t := Name(0); t != typeEnd; t++ {
 		Plugins().Instance(t)
 	}
 }
diff --git a/server/plugin/plugin_test.go b/server/plugin/plugin_test.go
index 2cbf810..4d03b1c 100644
--- a/server/plugin/plugin_test.go
+++ b/server/plugin/plugin_test.go
@@ -30,7 +30,7 @@ func (*mockAuthPlugin) Identify(r *http.Request) error {
 }
 
 func TestPluginManager_New(t *testing.T) {
-	pm := &PluginManager{}
+	pm := &Manager{}
 	pm.Initialize()
 
 	p := pm.Get(AUTH, "buildin")
@@ -39,7 +39,7 @@ func TestPluginManager_New(t *testing.T) {
 	}
 
 	times := 0
-	fn := func() PluginInstance {
+	fn := func() Instance {
 		times++
 		AUTH.ActiveConfigs().Set("a", "a")
 		return &mockAuthPlugin{times}
@@ -66,8 +66,8 @@ func TestPluginManager_New(t *testing.T) {
 			t.Fatalf("TestPluginManager_New failed")
 		}
 	}()
-	RegisterPlugin(Plugin{PluginName(999), "999", nil})
-	DynamicPluginFunc(PluginName(999), "999")
+	RegisterPlugin(Plugin{Name(999), "999", nil})
+	DynamicPluginFunc(Name(999), "999")
 
 	LoadPlugins()
 }
diff --git a/server/plugin/quota/buildin/buildin.go b/server/plugin/quota/buildin/buildin.go
index 1221c54..e7ddea8 100644
--- a/server/plugin/quota/buildin/buildin.go
+++ b/server/plugin/quota/buildin/buildin.go
@@ -29,7 +29,7 @@ func init() {
 	counter.RegisterCounterListener("buildin")
 }
 
-func New() mgr.PluginInstance {
+func New() mgr.Instance {
 	InitConfigs()
 	log.Infof("quota init, service: %d, instance: %d, schema: %d/service, tag: %d/service, rule: %d/service",
 		quota.DefaultServiceQuota, quota.DefaultInstanceQuota,
diff --git a/server/plugin/quota/unlimit/unlimit.go b/server/plugin/quota/unlimit/unlimit.go
index ff82d08..2d4cad7 100644
--- a/server/plugin/quota/unlimit/unlimit.go
+++ b/server/plugin/quota/unlimit/unlimit.go
@@ -41,7 +41,7 @@ func init() {
 type Unlimit struct {
 }
 
-func New() mgr.PluginInstance {
+func New() mgr.Instance {
 	log.Warnf("quota init, all resources are unlimited")
 	return &Unlimit{}
 }
diff --git a/server/plugin/registry/buildin/buildin.go b/server/plugin/registry/buildin/buildin.go
index 5ab08d2..43a5c13 100644
--- a/server/plugin/registry/buildin/buildin.go
+++ b/server/plugin/registry/buildin/buildin.go
@@ -72,7 +72,7 @@ func (ec *BuildinRegistry) Compact(ctx context.Context, reserve int64) error {
 func (ec *BuildinRegistry) Close() {
 }
 
-func NewRegistry() mgr.PluginInstance {
+func NewRegistry() mgr.Instance {
 	return &BuildinRegistry{
 		ready: make(chan int),
 	}
diff --git a/server/plugin/registry/embededetcd/embededetcd.go b/server/plugin/registry/embededetcd/embededetcd.go
index cd81777..e103225 100644
--- a/server/plugin/registry/embededetcd/embededetcd.go
+++ b/server/plugin/registry/embededetcd/embededetcd.go
@@ -526,7 +526,7 @@ func callback(action registry.ActionType, rev int64, kvs []*mvccpb.KeyValue, cb
 	})
 }
 
-func getEmbedInstance() mgr.PluginInstance {
+func getEmbedInstance() mgr.Instance {
 	log.Warnf("enable embedded registry mode")
 
 	hostName := "sc-0"
diff --git a/server/plugin/registry/etcd/etcd.go b/server/plugin/registry/etcd/etcd.go
index c62d6f1..6135379 100644
--- a/server/plugin/registry/etcd/etcd.go
+++ b/server/plugin/registry/etcd/etcd.go
@@ -853,7 +853,7 @@ func callback(action registry.ActionType, rev int64, kvs []*mvccpb.KeyValue, cb
 	})
 }
 
-func NewRegistry() mgr.PluginInstance {
+func NewRegistry() mgr.Instance {
 	log.Warnf("enable etcd registry mode")
 
 	inst := &EtcdClient{}
diff --git a/server/plugin/registry/etcd/etcd_test.go b/server/plugin/registry/etcd/etcd_test.go
index 9877aaa..2067a1e 100644
--- a/server/plugin/registry/etcd/etcd_test.go
+++ b/server/plugin/registry/etcd/etcd_test.go
@@ -17,7 +17,7 @@
 package etcd
 
 import (
-	_ "github.com/apache/servicecomb-service-center/server/plugin/tracing/buildin"
+	_ "github.com/apache/servicecomb-service-center/server/plugin/tracing/pzipkin"
 	"github.com/stretchr/testify/assert"
 )
 import _ "github.com/apache/servicecomb-service-center/server/plugin/security/buildin"
diff --git a/server/plugin/security/buildin/buildin.go b/server/plugin/security/buildin/buildin.go
index 091eb99..2fa0cc7 100644
--- a/server/plugin/security/buildin/buildin.go
+++ b/server/plugin/security/buildin/buildin.go
@@ -24,7 +24,7 @@ func init() {
 	mgr.RegisterPlugin(mgr.Plugin{mgr.CIPHER, "buildin", New})
 }
 
-func New() mgr.PluginInstance {
+func New() mgr.Instance {
 	return &DefaultCipher{}
 }
 
diff --git a/server/plugin/tls/buildin/buildin.go b/server/plugin/tls/buildin/buildin.go
index e43050f..82d69d4 100644
--- a/server/plugin/tls/buildin/buildin.go
+++ b/server/plugin/tls/buildin/buildin.go
@@ -25,7 +25,7 @@ func init() {
 	mgr.RegisterPlugin(mgr.Plugin{mgr.TLS, "buildin", New})
 }
 
-func New() mgr.PluginInstance {
+func New() mgr.Instance {
 	return &DefaultTLS{}
 }
 
diff --git a/server/plugin/tracing/buildin/buildin.go b/server/plugin/tracing/pzipkin/buildin.go
similarity index 99%
rename from server/plugin/tracing/buildin/buildin.go
rename to server/plugin/tracing/pzipkin/buildin.go
index 1b6c20e..fb76538 100644
--- a/server/plugin/tracing/buildin/buildin.go
+++ b/server/plugin/tracing/pzipkin/buildin.go
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package buildin
+package pzipkin
 
 import (
 	"context"
@@ -36,7 +36,7 @@ func init() {
 	mgr.RegisterPlugin(mgr.Plugin{mgr.TRACING, "buildin", New})
 }
 
-func New() mgr.PluginInstance {
+func New() mgr.Instance {
 	return &Zipkin{}
 }
 
diff --git a/server/plugin/tracing/buildin/buildin_test.go b/server/plugin/tracing/pzipkin/buildin_test.go
similarity index 99%
rename from server/plugin/tracing/buildin/buildin_test.go
rename to server/plugin/tracing/pzipkin/buildin_test.go
index 2d02b55..c9e0b8b 100644
--- a/server/plugin/tracing/buildin/buildin_test.go
+++ b/server/plugin/tracing/pzipkin/buildin_test.go
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package buildin
+package pzipkin
 
 import (
 	"context"
diff --git a/server/plugin/tracing/buildin/common.go b/server/plugin/tracing/pzipkin/common.go
similarity index 99%
rename from server/plugin/tracing/buildin/common.go
rename to server/plugin/tracing/pzipkin/common.go
index 80b43f4..431bc1b 100644
--- a/server/plugin/tracing/buildin/common.go
+++ b/server/plugin/tracing/pzipkin/common.go
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package buildin
+package pzipkin
 
 import (
 	"fmt"
diff --git a/server/plugin/tracing/buildin/common_test.go b/server/plugin/tracing/pzipkin/common_test.go
similarity index 99%
rename from server/plugin/tracing/buildin/common_test.go
rename to server/plugin/tracing/pzipkin/common_test.go
index f82d187..fb005a0 100644
--- a/server/plugin/tracing/buildin/common_test.go
+++ b/server/plugin/tracing/pzipkin/common_test.go
@@ -13,7 +13,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package buildin
+package pzipkin
 
 import (
 	"github.com/openzipkin/zipkin-go-opentracing"
diff --git a/server/plugin/tracing/buildin/file_collector.go b/server/plugin/tracing/pzipkin/file_collector.go
similarity index 99%
rename from server/plugin/tracing/buildin/file_collector.go
rename to server/plugin/tracing/pzipkin/file_collector.go
index f3deec0..12d2f90 100644
--- a/server/plugin/tracing/buildin/file_collector.go
+++ b/server/plugin/tracing/pzipkin/file_collector.go
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package buildin
+package pzipkin
 
 import (
 	"bufio"
diff --git a/server/plugin/tracing/buildin/file_collector_test.go b/server/plugin/tracing/pzipkin/file_collector_test.go
similarity index 99%
rename from server/plugin/tracing/buildin/file_collector_test.go
rename to server/plugin/tracing/pzipkin/file_collector_test.go
index 2fc833e..93a4895 100644
--- a/server/plugin/tracing/buildin/file_collector_test.go
+++ b/server/plugin/tracing/pzipkin/file_collector_test.go
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package buildin
+package pzipkin
 
 import (
 	"context"
diff --git a/server/plugin/tracing/buildin/span.go b/server/plugin/tracing/pzipkin/span.go
similarity index 99%
rename from server/plugin/tracing/buildin/span.go
rename to server/plugin/tracing/pzipkin/span.go
index 70088ee..a96ea4b 100644
--- a/server/plugin/tracing/buildin/span.go
+++ b/server/plugin/tracing/pzipkin/span.go
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package buildin
+package pzipkin
 
 import (
 	"github.com/apache/servicecomb-service-center/pkg/util"
diff --git a/server/plugin/tracing/buildin/span_test.go b/server/plugin/tracing/pzipkin/span_test.go
similarity index 99%
rename from server/plugin/tracing/buildin/span_test.go
rename to server/plugin/tracing/pzipkin/span_test.go
index fcf8667..93b80a2 100644
--- a/server/plugin/tracing/buildin/span_test.go
+++ b/server/plugin/tracing/pzipkin/span_test.go
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package buildin
+package pzipkin
 
 import (
 	"encoding/json"
diff --git a/server/plugin/types.go b/server/plugin/types.go
index 30c3208..1c79890 100644
--- a/server/plugin/types.go
+++ b/server/plugin/types.go
@@ -22,18 +22,18 @@ import (
 	"github.com/apache/servicecomb-service-center/server/core"
 )
 
-// PluginName is an alias, it represents a plugin interface.
-type PluginName int
+// Name is an alias, it represents a plugin interface.
+type Name int
 
-// PluginImplName is an alias,it represents a plugin interface implementation.
-type PluginImplName string
+// ImplName is an alias,it represents a plugin interface implementation.
+type ImplName string
 
-// PluginInstance is an instance of a plugin interface which is represented by
-// PluginName.
-type PluginInstance interface{}
+// Instance is an instance of a plugin interface which is represented by
+// Name.
+type Instance interface{}
 
 // String implements fmt.Stringer.
-func (pn PluginName) String() string {
+func (pn Name) String() string {
 	if name, ok := pluginNames[pn]; ok {
 		return name
 	}
@@ -41,21 +41,21 @@ func (pn PluginName) String() string {
 }
 
 // ActiveConfigs returns all the server's plugin config
-func (pn PluginName) ActiveConfigs() util.JSONObject {
+func (pn Name) ActiveConfigs() util.JSONObject {
 	return core.ServerInfo.Config.Plugins.Object(pn.String())
 }
 
 // ClearConfigs clears the server's plugin config
-func (pn PluginName) ClearConfigs() {
+func (pn Name) ClearConfigs() {
 	core.ServerInfo.Config.Plugins.Set(pn.String(), nil)
 }
 
 // Plugin generates a plugin instance
-// Plugin holds the 'PluginName' and 'PluginImplName'
+// Plugin holds the 'Name' and 'ImplName'
 // to manage the plugin instance generation.
 type Plugin struct {
-	PName PluginName
-	Name  PluginImplName
+	PName Name
+	Name  ImplName
 	// New news an instance of 'PName' represented plugin interface
-	New func() PluginInstance
+	New func() Instance
 }
diff --git a/server/plugin/uuid/buildin/buildin.go b/server/plugin/uuid/buildin/buildin.go
index 4b27bd5..24859f2 100644
--- a/server/plugin/uuid/buildin/buildin.go
+++ b/server/plugin/uuid/buildin/buildin.go
@@ -27,7 +27,7 @@ func init() {
 	mgr.RegisterPlugin(mgr.Plugin{mgr.UUID, "buildin", New})
 }
 
-func New() mgr.PluginInstance {
+func New() mgr.Instance {
 	return &BuildinUUID{}
 }
 
diff --git a/server/plugin/uuid/context/context.go b/server/plugin/uuid/context/context.go
index 6242870..5eb793b 100644
--- a/server/plugin/uuid/context/context.go
+++ b/server/plugin/uuid/context/context.go
@@ -31,7 +31,7 @@ func init() {
 	mgr.RegisterPlugin(mgr.Plugin{mgr.UUID, "context", New})
 }
 
-func New() mgr.PluginInstance {
+func New() mgr.Instance {
 	return &ContextUUID{}
 }
 
diff --git a/server/service/kv/store_test.go b/server/service/kv/store_test.go
index 493e97f..2692460 100644
--- a/server/service/kv/store_test.go
+++ b/server/service/kv/store_test.go
@@ -22,7 +22,7 @@ import (
 	mgr "github.com/apache/servicecomb-service-center/server/plugin"
 	"github.com/apache/servicecomb-service-center/server/plugin/discovery/etcd"
 	etcd2 "github.com/apache/servicecomb-service-center/server/plugin/registry/etcd"
-	"github.com/apache/servicecomb-service-center/server/plugin/tracing/buildin"
+	"github.com/apache/servicecomb-service-center/server/plugin/tracing/pzipkin"
 	"github.com/apache/servicecomb-service-center/server/service/kv"
 	"github.com/astaxie/beego"
 	"github.com/stretchr/testify/assert"
@@ -34,7 +34,7 @@ func init() {
 	mgr.RegisterPlugin(mgr.Plugin{mgr.REGISTRY, "etcd", etcd2.NewRegistry})
 	mgr.RegisterPlugin(mgr.Plugin{mgr.DISCOVERY, "buildin", etcd.NewRepository})
 	mgr.RegisterPlugin(mgr.Plugin{mgr.DISCOVERY, "etcd", etcd.NewRepository})
-	mgr.RegisterPlugin(mgr.Plugin{mgr.TRACING, "buildin", buildin.New})
+	mgr.RegisterPlugin(mgr.Plugin{mgr.TRACING, "buildin", pzipkin.New})
 
 }
 func TestStoreData(t *testing.T) {
diff --git a/server/service/rbac/dao/account_dao_test.go b/server/service/rbac/dao/account_dao_test.go
index 9bf8b65..7d6cd22 100644
--- a/server/service/rbac/dao/account_dao_test.go
+++ b/server/service/rbac/dao/account_dao_test.go
@@ -23,7 +23,7 @@ import (
 	mgr "github.com/apache/servicecomb-service-center/server/plugin"
 	"github.com/apache/servicecomb-service-center/server/plugin/discovery/etcd"
 	etcd2 "github.com/apache/servicecomb-service-center/server/plugin/registry/etcd"
-	"github.com/apache/servicecomb-service-center/server/plugin/tracing/buildin"
+	"github.com/apache/servicecomb-service-center/server/plugin/tracing/pzipkin"
 	"github.com/apache/servicecomb-service-center/server/service/rbac/dao"
 	"github.com/astaxie/beego"
 	"github.com/stretchr/testify/assert"
@@ -35,7 +35,7 @@ func init() {
 	mgr.RegisterPlugin(mgr.Plugin{mgr.REGISTRY, "etcd", etcd2.NewRegistry})
 	mgr.RegisterPlugin(mgr.Plugin{mgr.DISCOVERY, "buildin", etcd.NewRepository})
 	mgr.RegisterPlugin(mgr.Plugin{mgr.DISCOVERY, "etcd", etcd.NewRepository})
-	mgr.RegisterPlugin(mgr.Plugin{mgr.TRACING, "buildin", buildin.New})
+	mgr.RegisterPlugin(mgr.Plugin{mgr.TRACING, "buildin", pzipkin.New})
 
 }
 func TestAccountDao_CreateAccount(t *testing.T) {
diff --git a/server/service/rbac/rbac.go b/server/service/rbac/rbac.go
index 3d6d953..ae158a8 100644
--- a/server/service/rbac/rbac.go
+++ b/server/service/rbac/rbac.go
@@ -30,6 +30,7 @@ import (
 	"github.com/go-chassis/go-chassis/security/authr"
 	"github.com/go-chassis/go-chassis/security/secret"
 	"io/ioutil"
+	"k8s.io/apimachinery/pkg/util/sets"
 )
 
 const (
@@ -143,3 +144,12 @@ func GetPrivateKey() (*rsa.PrivateKey, error) {
 	}
 	return p, nil
 }
+
+var whiteAPIList = sets.NewString("/health", "/version", "/v4/token")
+
+func Add2WhiteAPIList(path string) {
+	whiteAPIList.Insert(path)
+}
+func WhiteAPIList() sets.String {
+	return whiteAPIList
+}
diff --git a/server/service/rbac/rbca_test.go b/server/service/rbac/rbca_test.go
index f2b9dab..54388f5 100644
--- a/server/service/rbac/rbca_test.go
+++ b/server/service/rbac/rbca_test.go
@@ -24,7 +24,7 @@ import (
 	"github.com/apache/servicecomb-service-center/server/plugin/discovery/etcd"
 	etcd2 "github.com/apache/servicecomb-service-center/server/plugin/registry/etcd"
 	"github.com/apache/servicecomb-service-center/server/plugin/security/buildin"
-	"github.com/apache/servicecomb-service-center/server/plugin/tracing/buildin"
+	"github.com/apache/servicecomb-service-center/server/plugin/tracing/pzipkin"
 	"github.com/apache/servicecomb-service-center/server/service/rbac"
 	"github.com/apache/servicecomb-service-center/server/service/rbac/dao"
 	"github.com/astaxie/beego"
@@ -45,7 +45,7 @@ func init() {
 	mgr.RegisterPlugin(mgr.Plugin{mgr.DISCOVERY, "buildin", etcd.NewRepository})
 	mgr.RegisterPlugin(mgr.Plugin{mgr.DISCOVERY, "etcd", etcd.NewRepository})
 	mgr.RegisterPlugin(mgr.Plugin{mgr.CIPHER, "buildin", plain.New})
-	mgr.RegisterPlugin(mgr.Plugin{mgr.TRACING, "buildin", buildin.New})
+	mgr.RegisterPlugin(mgr.Plugin{mgr.TRACING, "buildin", pzipkin.New})
 }
 
 func TestInitRBAC(t *testing.T) {