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 2022/10/28 01:04:48 UTC
[GitHub] [apisix-dashboard] nic-chen commented on a diff in pull request #2608: feat: Add login filter of OpenID-Connect Login
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 's@127.0.0.1@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 's@0.0.0.0/0:9000@127.0.0.1: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: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org