1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-09 19:56:44 -05:00

return on prefix mismatch

This commit is contained in:
Shelikhoo 2021-09-06 14:16:21 +01:00
parent 1cb3ee5f6d
commit 9f8f420ed3
No known key found for this signature in database
GPG Key ID: C4D5E79D22B25316

View File

@ -69,6 +69,7 @@ func (r *restfulService) TokenAuthMiddleware() gin.HandlerFunc {
if !strings.HasPrefix(auth, prefix) {
c.JSON(http.StatusUnauthorized, "unauthorized")
c.Abort()
return
}
auth = strings.TrimPrefix(auth, prefix)
if auth != r.config.AuthToken { // tip: Bearer: token123