nic-chen commented on code in PR #2608:
URL: https://github.com/apache/apisix-dashboard/pull/2608#discussion_r1007500611


##########
api/internal/filter/authentication.go:
##########
@@ -29,53 +29,61 @@ import (
 
 func Authentication() gin.HandlerFunc {
        return func(c *gin.Context) {
-               if c.Request.URL.Path == "/apisix/admin/user/login" ||
-                       c.Request.URL.Path == "/apisix/admin/tool/version" ||
-                       !strings.HasPrefix(c.Request.URL.Path, "/apisix") {
-                       c.Next()
-                       return
-               }
-
-               tokenStr := c.GetHeader("Authorization")
-               // verify token
-               token, err := jwt.ParseWithClaims(tokenStr, 
&jwt.StandardClaims{}, func(token *jwt.Token) (interface{}, error) {
-                       return []byte(conf.AuthConf.Secret), nil
-               })
-
+               cookie, _ := conf.CookieStore.Get(c.Request, "oidc")
                errResp := gin.H{
                        "code":    010013,
                        "message": "request unauthorized",
                }
 
-               if err != nil || token == nil || !token.Valid {
-                       log.Warnf("token validate failed: %s", err)
-                       c.AbortWithStatusJSON(http.StatusUnauthorized, errResp)
-                       return
-               }
+               if cookie.IsNew {
+                       if c.Request.URL.Path == "/apisix/admin/user/login" ||
+                               c.Request.URL.Path == 
"/apisix/admin/tool/version" ||
+                               !strings.HasPrefix(c.Request.URL.Path, 
"/apisix") {

Review Comment:
   we should put this block out of the block `if cookie.IsNew {`



##########
.github/workflows/backend-e2e-test.yml:
##########
@@ -44,6 +44,8 @@ jobs:
           sed -i '[email protected]@0.0.0.0/0@' ./api/conf/conf.yaml
           sed -i '/172.16.238.10:2379/a\      - 172.16.238.11:2379' 
./api/conf/conf.yaml
           sed -i '/172.16.238.10:2379/a\      - 172.16.238.12:2379' 
./api/conf/conf.yaml
+          sed -i '[email protected]/0:[email protected]:9000@' ./api/conf/conf.yaml

Review Comment:
   Why amend here? Looks like it can only be accessed locally
   



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