little-cui commented on a change in pull request #1119:
URL: 
https://github.com/apache/servicecomb-service-center/pull/1119#discussion_r680759873



##########
File path: server/service/rbac/context.go
##########
@@ -47,3 +51,24 @@ func AccountFromContext(ctx context.Context) 
(*rbacmodel.Account, error) {
        }
        return rbacmodel.GetAccount(m)
 }
+
+func WithToken(req *http.Request, token string) *http.Request {
+       return util.SetRequestContext(req, CtxRequestToken, token)
+}
+
+func TokenFromRequest(req *http.Request) string {
+       token, ok := req.Context().Value(CtxRequestToken).(string)
+       if !ok {
+               return ""
+       }
+       return token
+}
+
+func SignRequest(req *http.Request) error {
+       token := TokenFromRequest(req)
+       if token == "" {
+               return errors.New("request unauthorized")
+       }
+       return nil

Review comment:
       缺少设置request header的逻辑




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to