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 2021/08/16 16:36:18 UTC
[servicecomb-service-center] branch master updated: Fix: add
disabled situation (#1141)
This is an automated email from the ASF dual-hosted git repository.
littlecui 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 aa5e53a Fix: add disabled situation (#1141)
aa5e53a is described below
commit aa5e53ae29de8fd9728213601d38c7359d979816
Author: little-cui <su...@qq.com>
AuthorDate: Tue Aug 17 00:36:13 2021 +0800
Fix: add disabled situation (#1141)
---
server/service/gov/kie/kie_distributor.go | 10 +++-------
server/service/rbac/context.go | 2 +-
2 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/server/service/gov/kie/kie_distributor.go b/server/service/gov/kie/kie_distributor.go
index 9284604..d1184ec 100644
--- a/server/service/gov/kie/kie_distributor.go
+++ b/server/service/gov/kie/kie_distributor.go
@@ -274,16 +274,12 @@ func (d *Distributor) Name() string {
}
func initClient(endpoint string) *kie.Client {
- var options *httpclient.Options
- if rbacsvc.Enabled() {
- options = &httpclient.Options{
- SignRequest: rbacsvc.SignRequest,
- }
- }
client, err := kie.NewClient(
kie.Config{Endpoint: endpoint,
DefaultLabels: map[string]string{},
- HTTPOptions: options,
+ HTTPOptions: &httpclient.Options{
+ SignRequest: rbacsvc.SignRequest,
+ },
})
if err != nil {
log.Fatal("init kie client failed, err: %s", err)
diff --git a/server/service/rbac/context.go b/server/service/rbac/context.go
index 3854033..877d656 100644
--- a/server/service/rbac/context.go
+++ b/server/service/rbac/context.go
@@ -54,7 +54,7 @@ func AccountFromContext(ctx context.Context) (*rbacmodel.Account, error) {
func SignRequest(req *http.Request) error {
auth := token.FromContext(req.Context())
if auth == "" {
- return errors.New("request unauthorized")
+ return nil
}
req.Header.Set("Authorization", "Bearer "+auth)
return nil