[fixed] updated jwt library to avoid an error when counting tokens

Signed-off-by: Matthias Hanel <mh@synadia.com>
This commit is contained in:
Matthias Hanel
2021-07-27 12:45:16 -04:00
parent ba4a271cf6
commit c7f7077584
5 changed files with 10 additions and 9 deletions

2
go.mod
View File

@@ -6,7 +6,7 @@ require (
github.com/golang/protobuf v1.4.2 // indirect
github.com/klauspost/compress v1.11.12
github.com/minio/highwayhash v1.0.1
github.com/nats-io/jwt/v2 v2.0.2
github.com/nats-io/jwt/v2 v2.0.3-0.20210715221700-37a10b0187c7
github.com/nats-io/nats.go v1.11.1-0.20210623165838-4b75fc59ae30
github.com/nats-io/nkeys v0.3.0
github.com/nats-io/nuid v1.0.1

2
go.sum
View File

@@ -16,6 +16,8 @@ github.com/nats-io/jwt v1.2.2 h1:w3GMTO969dFg+UOKTmmyuu7IGdusK+7Ytlt//OYH/uU=
github.com/nats-io/jwt v1.2.2/go.mod h1:/xX356yQA6LuXI9xWW7mZNpxgF2mBmGecH+Fj34sP5Q=
github.com/nats-io/jwt/v2 v2.0.2 h1:ejVCLO8gu6/4bOKIHQpmB5UhhUJfAQw55yvLWpfmKjI=
github.com/nats-io/jwt/v2 v2.0.2/go.mod h1:VRP+deawSXyhNjXmxPCHskrR6Mq50BqpEI5SEcNiGlY=
github.com/nats-io/jwt/v2 v2.0.3-0.20210715221700-37a10b0187c7 h1:UG297bO9pMQUnwvv74Z3m0BmvTtf/9VtMmBBDZn3WB4=
github.com/nats-io/jwt/v2 v2.0.3-0.20210715221700-37a10b0187c7/go.mod h1:VRP+deawSXyhNjXmxPCHskrR6Mq50BqpEI5SEcNiGlY=
github.com/nats-io/nats.go v1.11.1-0.20210623165838-4b75fc59ae30 h1:9GqilBhZaR3xYis0JgMlJjNw933WIobdjKhilXm+Vls=
github.com/nats-io/nats.go v1.11.1-0.20210623165838-4b75fc59ae30/go.mod h1:BPko4oXsySz4aSWeFgOHLZs3G4Jq4ZAyE6/zMCxRT6w=
github.com/nats-io/nkeys v0.2.0/go.mod h1:XdZpAbhgyyODYqjTawOnIOI7VlbKSarI9Gfy1tqEu/s=

View File

@@ -42,7 +42,7 @@ const (
// Results is the subject where the latency metrics are published.
// A metric will be defined by the nats-server's ServiceLatency. Time durations
// are in nanoseconds.
// see https://github.com/nats-io/nats-server/blob/master/server/accounts.go#L524
// see https://github.com/nats-io/nats-server/blob/main/server/accounts.go#L524
// e.g.
// {
// "app": "dlc22",

View File

@@ -188,12 +188,11 @@ func (s Subject) countTokenWildcards() int {
if v == "*" {
return 1
}
cnt := strings.Count(v, ".*.")
if strings.HasSuffix(v, ".*") {
cnt++
}
if strings.HasPrefix(v, "*.") {
cnt++
cnt := 0
for _, t := range strings.Split(v, ".") {
if t == "*" {
cnt++
}
}
return cnt
}

2
vendor/modules.txt vendored
View File

@@ -6,7 +6,7 @@ github.com/klauspost/compress/s2
# github.com/minio/highwayhash v1.0.1
## explicit
github.com/minio/highwayhash
# github.com/nats-io/jwt/v2 v2.0.2
# github.com/nats-io/jwt/v2 v2.0.3-0.20210715221700-37a10b0187c7
## explicit
github.com/nats-io/jwt/v2
# github.com/nats-io/nats.go v1.11.1-0.20210623165838-4b75fc59ae30