You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by li...@apache.org on 2022/10/22 07:06:14 UTC

[servicecomb-service-center] 01/01: Change: always authenticate the request with HTTP Header 'Authorization'

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

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

commit c36b790b3274a73c601adf514f2ab58856c4423f
Author: little-cui <su...@qq.com>
AuthorDate: Sat Oct 22 14:33:23 2022 +0800

    Change: always authenticate the request with HTTP Header 'Authorization'
---
 etc/conf/app.yaml                     | 5 ++++-
 server/plugin/auth/buildin/buildin.go | 2 +-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/etc/conf/app.yaml b/etc/conf/app.yaml
index 94b940ca..06259fb0 100644
--- a/etc/conf/app.yaml
+++ b/etc/conf/app.yaml
@@ -169,7 +169,10 @@ rbac:
   publicKeyFile: ./public.key
   releaseLockAfter: 15m # failure login attempt causes account blocking, that is block duration
   retainLockHistoryFor: 20m # the ttl of lock history
-  scope: '*' # specify auth resource scope, can be account,role,service,service/schema,...
+  # specify auth resource scope, can be account,role,service,service/schema,...
+  # The authenticator skip the authentication of the request, if the resource type of the request is not specified in the scope
+  # The authenticator always authenticate the request with the HTTP Header 'Authorization'.
+  scope: '*'
 
 metrics:
   # enable to start metrics gather
diff --git a/server/plugin/auth/buildin/buildin.go b/server/plugin/auth/buildin/buildin.go
index 3b4eb089..bc8f2829 100644
--- a/server/plugin/auth/buildin/buildin.go
+++ b/server/plugin/auth/buildin/buildin.go
@@ -61,7 +61,7 @@ func (ba *TokenAuthenticator) Identify(req *http.Request) error {
 		log.Warn("can not find api pattern")
 	}
 
-	if !rbacsvc.MustAuth(pattern) {
+	if v := req.Header.Get(restful.HeaderAuth); len(v) == 0 && !rbacsvc.MustAuth(pattern) {
 		return nil
 	}