()
| 190 | } |
| 191 | |
| 192 | func AuthMiddleware() gin.HandlerFunc { |
| 193 | return func(c *gin.Context) { |
| 194 | err := auth.GetDefaultAuth().CheckToken(c.Request) |
| 195 | if err != nil { |
| 196 | c.JSON(http.StatusUnauthorized, apitypes.Error("Unauthorized", err)) |
| 197 | c.Abort() |
| 198 | return |
| 199 | } |
| 200 | c.Next() |
| 201 | } |
| 202 | } |
| 203 | |
| 204 | func SkipOriginCheckMiddleware() gin.HandlerFunc { |
| 205 | upgrader := &websocket.Upgrader{ |
no test coverage detected