|
|
|
@ -55,15 +55,12 @@ func aclMiddleware(s *Server, next echo.HandlerFunc) echo.HandlerFunc {
|
|
|
|
|
return func(c echo.Context) error {
|
|
|
|
|
ctx := c.Request().Context()
|
|
|
|
|
path := c.Path()
|
|
|
|
|
|
|
|
|
|
// Skip auth.
|
|
|
|
|
if common.HasPrefixes(path, "/api/auth") {
|
|
|
|
|
return next(c)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if common.HasPrefixes(path, "/api/ping", "/api/status", "/api/user/:id") && c.Request().Method == http.MethodGet {
|
|
|
|
|
return next(c)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
// If there is openId in query string and related user is found, then skip auth.
|
|
|
|
|
openID := c.QueryParam("openId")
|
|
|
|
@ -104,7 +101,7 @@ func aclMiddleware(s *Server, next echo.HandlerFunc) echo.HandlerFunc {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if common.HasPrefixes(path, "/api/memo/all", "/api/memo/:memoId", "/api/memo/amount") && c.Request().Method == http.MethodGet {
|
|
|
|
|
if common.HasPrefixes(path, "/api/ping", "/api/status", "/api/user/:id", "/api/memo/all", "/api/memo/:memoId", "/api/memo/amount") && c.Request().Method == http.MethodGet {
|
|
|
|
|
return next(c)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|