You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2020/10/20 07:15:19 UTC

[GitHub] [apisix-dashboard] juzhiyuan commented on a change in pull request #564: feat: refactor `manager api`

juzhiyuan commented on a change in pull request #564:
URL: https://github.com/apache/apisix-dashboard/pull/564#discussion_r508257873



##########
File path: .github/workflows/api_ci.yml
##########
@@ -4,9 +4,11 @@ on:
   push:
     branches:
       - master
+      - refactor

Review comment:
       We don't need this branch anymore

##########
File path: api/filter/authentication.go
##########
@@ -17,49 +17,55 @@
 package filter
 
 import (
-	"github.com/apisix/manager-api/conf"
-	"github.com/apisix/manager-api/errno"
-	"github.com/dgrijalva/jwt-go"
-	"github.com/gin-gonic/gin"
 	"net/http"
 	"strings"
+
+	"github.com/dgrijalva/jwt-go"
+	"github.com/gin-gonic/gin"
+
+	"github.com/apisix/manager-api/conf"
 )
 
 func Authentication() gin.HandlerFunc {
 	return func(c *gin.Context) {
-		if c.Request.URL.Path != "/apisix/admin/user/login" && strings.HasPrefix(c.Request.URL.Path,"/apisix") {
+		if c.Request.URL.Path != "/apisix/admin/user/login" && strings.HasPrefix(c.Request.URL.Path, "/apisix") {
 			tokenStr := c.GetHeader("Authorization")
 
 			// verify token
 			token, err := jwt.ParseWithClaims(tokenStr, &jwt.StandardClaims{}, func(token *jwt.Token) (interface{}, error) {
 				return []byte(conf.AuthenticationConfig.Session.Secret), nil
 			})
 
-			if err != nil {
-				c.AbortWithStatusJSON(http.StatusUnauthorized, errno.FromMessage(errno.ForbiddenError).Response())
+			errResp := gin.H{
+				"code":    010013,

Review comment:
       Do we have a complete mapper?

##########
File path: api/internal/core/storage/storage_mock.go
##########
@@ -0,0 +1,116 @@
+// Code generated by mockery v1.0.0. DO NOT EDIT.

Review comment:
       License?

##########
File path: api/internal/core/store/selector_test.go
##########
@@ -0,0 +1,285 @@
+/*

Review comment:
       ??????

##########
File path: api/internal/core/entity/query.go
##########
@@ -0,0 +1,153 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more

Review comment:
       Double licenses?

##########
File path: api/build-tools/json.lua
##########
@@ -0,0 +1,400 @@
+--
+-- json.lua
+--
+-- Copyright (c) 2020 rxi

Review comment:
       Does this file's license is compatible with Apache License 2.0?

##########
File path: api/internal/core/store/validate_mock.go
##########
@@ -0,0 +1,24 @@
+// Code generated by mockery v1.0.0. DO NOT EDIT.

Review comment:
       License

##########
File path: api/internal/core/store/selector.go
##########
@@ -0,0 +1,144 @@
+/*

Review comment:
       ???

##########
File path: api/internal/core/store/query.go
##########
@@ -0,0 +1,151 @@
+/*

Review comment:
       ???




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org