Explorar el Código

apiprovideo 添加只验证token

liuxiulin hace 2 semanas
padre
commit
5ca980fa1c
Se han modificado 1 ficheros con 6 adiciones y 7 borrados
  1. 6 7
      services/apiprovider/middleware.go

+ 6 - 7
services/apiprovider/middleware.go

@@ -87,10 +87,9 @@ func ApplicationAuthOnDeviceIdentifer(context martini.Context, params martini.Pa
 }
 
 func ApplicationAuth(context martini.Context, params martini.Params, req *http.Request, r render.Render) {
-	identifier := params["identifier"]
 	key := req.Header.Get("App-Key")
 
-	if identifier == "" || key == "" {
+	if key == "" {
 		r.JSON(http.StatusOK, renderError(ErrDeviceNotFound, errors.New("missing device identifier or app key.")))
 		return
 	}
@@ -102,11 +101,11 @@ func ApplicationAuth(context martini.Context, params martini.Params, req *http.R
 		return
 	}
 
-	err = checkAppDomain(app.AppDomain, identifier)
-	if err != nil {
-		r.JSON(http.StatusOK, renderError(ErrAccessDenied, err))
-		return
-	}
+	//err = checkAppDomain(app.AppDomain, identifier)
+	//if err != nil {
+	//	r.JSON(http.StatusOK, renderError(ErrAccessDenied, err))
+	//	return
+	//}
 
 }